Clients that request the selection services menu after WebKit2 will get one with...
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Aug 2014 23:15:55 +0000 (23:15 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Aug 2014 23:15:55 +0000 (23:15 +0000)
https://bugs.webkit.org/show_bug.cgi?id=135765
<rdar://problem/17962180>

Reviewed by Brady Eidson.

* UIProcess/mac/WebContextMenuProxyMac.mm:
(WebKit::WebContextMenuProxyMac::setupServicesMenu):
The menu is cached between clients, but we make adjustments to it.
We should copy it before adjusting.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@172364 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm

index 465bbd573ba8496002beaccf48b601b20eae72c7..ba15e39153f5507357084b0065292a11322a2649 100644 (file)
@@ -1,3 +1,16 @@
+2014-08-08  Timothy Horton  <timothy_horton@apple.com>
+
+        Clients that request the selection services menu after WebKit2 will get one with different metrics than otherwise
+        https://bugs.webkit.org/show_bug.cgi?id=135765
+        <rdar://problem/17962180>
+
+        Reviewed by Brady Eidson.
+
+        * UIProcess/mac/WebContextMenuProxyMac.mm:
+        (WebKit::WebContextMenuProxyMac::setupServicesMenu):
+        The menu is cached between clients, but we make adjustments to it.
+        We should copy it before adjusting.
+
 2014-08-08  Timothy Horton  <timothy_horton@apple.com>
 
         Services overlay dropdown is often in the wrong place with zoomed pages or horizontal scrolling
index a0745229984befe1f77023a387086b88a9a7e3d1..cc5e8146d3b9e66d1cd196d36b452203be890fc6 100644 (file)
@@ -370,7 +370,6 @@ static Vector<RetainPtr<NSMenuItem>> nsMenuItemVector(const Vector<WebContextMen
 
 void WebContextMenuProxyMac::setupServicesMenu(const ContextMenuContextData& context)
 {
-    RetainPtr<NSSharingServicePicker> picker;
     bool includeEditorServices = context.controlledDataIsEditable();
     bool hasControlledImage = !context.controlledImageHandle().isNull();
     NSArray *items = nil;
@@ -392,13 +391,13 @@ void WebContextMenuProxyMac::setupServicesMenu(const ContextMenuContextData& con
         return;
     }
 
-    picker = adoptNS([[NSSharingServicePicker alloc] initWithItems:items]);
+    RetainPtr<NSSharingServicePicker> picker = adoptNS([[NSSharingServicePicker alloc] initWithItems:items]);
     [picker setStyle:hasControlledImage ? NSSharingServicePickerStyleRollover : NSSharingServicePickerStyleTextSelection];
     [picker setDelegate:[WKSharingServicePickerDelegate sharedSharingServicePickerDelegate]];
     [[WKSharingServicePickerDelegate sharedSharingServicePickerDelegate] setPicker:picker.get()];
     [[WKSharingServicePickerDelegate sharedSharingServicePickerDelegate] setIncludeEditorServices:includeEditorServices];
 
-    m_servicesMenu = [picker menu];
+    m_servicesMenu = adoptNS([[picker menu] copy]);
 
     if (!hasControlledImage)
         [m_servicesMenu setShowsStateColumn:YES];