Skip to content

Commit d6d2a4c

Browse files
committed
Address safer CPP failures in WebPopupMenuProxyMac.h
https://bugs.webkit.org/show_bug.cgi?id=290270 Reviewed by Geoffrey Garen. * Source/WebKit/SaferCPPExpectations/NoUnretainedMemberCheckerExpectations: * Source/WebKit/UIProcess/mac/WebPopupMenuProxyMac.h: * Source/WebKit/UIProcess/mac/WebPopupMenuProxyMac.mm: (WebKit::WebPopupMenuProxyMac::showPopupMenu): Canonical link: https://commits.webkit.org/292562@main
1 parent 3f542b8 commit d6d2a4c

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm
22
UIProcess/DisplayLink.h
33
UIProcess/mac/PageClientImplMac.h
4-
UIProcess/mac/WebPopupMenuProxyMac.h
54
UIProcess/mac/WebViewImpl.h
65
WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm
76
WebProcess/InjectedBundle/InjectedBundle.h

Source/WebKit/UIProcess/mac/WebPopupMenuProxyMac.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
#include "WebPopupMenuProxy.h"
3232
#include <wtf/RetainPtr.h>
33+
#include <wtf/WeakObjCPtr.h>
3334

3435
OBJC_CLASS NSPopUpButtonCell;
3536
OBJC_CLASS WKView;
@@ -56,7 +57,7 @@ class WebPopupMenuProxyMac : public WebPopupMenuProxy {
5657
void populate(const Vector<WebPopupItem>&, NSFont *, WebCore::TextDirection);
5758

5859
RetainPtr<NSPopUpButtonCell> m_popup;
59-
NSView *m_webView;
60+
WeakObjCPtr<NSView> m_webView;
6061
bool m_wasCanceled;
6162
};
6263

Source/WebKit/UIProcess/mac/WebPopupMenuProxyMac.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121

122122
populate(items, font, textDirection);
123123

124-
[m_popup attachPopUpWithFrame:rect inView:m_webView];
124+
[m_popup attachPopUpWithFrame:rect inView:m_webView.get().get()];
125125
[m_popup selectItemAtIndex:selectedIndex];
126126
[m_popup setUserInterfaceLayoutDirection:textDirection == TextDirection::LTR ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft];
127127

@@ -154,7 +154,7 @@
154154
RetainPtr<NSView> dummyView = adoptNS([[NSView alloc] initWithFrame:rect]);
155155
[dummyView.get() setUserInterfaceLayoutDirection:textDirection == TextDirection::LTR ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft];
156156
[m_webView addSubview:dummyView.get()];
157-
location = [dummyView convertPoint:location fromView:m_webView];
157+
location = [dummyView convertPoint:location fromView:m_webView.get().get()];
158158

159159
NSControlSize controlSize;
160160
switch (data.menuSize) {

0 commit comments

Comments
 (0)