Title: [191449] trunk/Source/WebKit2
- Revision
- 191449
- Author
- [email protected]
- Date
- 2015-10-22 02:49:33 -0700 (Thu, 22 Oct 2015)
Log Message
Unreviewed. Fix a crash in GTk+ after r191402.
Since r191402 WebContextMenuProxy is no longer refcounted, and
std::unique_ptr is used instead. This means that when we show the
context menu for the second time in a web view, a new
WebContextMenuProxy is created and the previous one is
destroyed. We were setting the active context menu of the WebView
in the constructor of WebContextMenuProxy, and unsetting it in the
destructor. Now the constructor of the new WebContextMenuProxy
happens before the destructor of the current one that unsets the
WebView active context menu. This patch simply makes the web view
unset its active context menu when it's unmapped and a new one
hasn't been set.
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(activeContextMenuUnmapped):
(webkitWebViewBaseSetActiveContextMenuProxy):
* UIProcess/gtk/WebContextMenuProxyGtk.cpp:
(WebKit::WebContextMenuProxyGtk::~WebContextMenuProxyGtk):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (191448 => 191449)
--- trunk/Source/WebKit2/ChangeLog 2015-10-22 08:56:01 UTC (rev 191448)
+++ trunk/Source/WebKit2/ChangeLog 2015-10-22 09:49:33 UTC (rev 191449)
@@ -1,3 +1,25 @@
+2015-10-22 Carlos Garcia Campos <[email protected]>
+
+ Unreviewed. Fix a crash in GTk+ after r191402.
+
+ Since r191402 WebContextMenuProxy is no longer refcounted, and
+ std::unique_ptr is used instead. This means that when we show the
+ context menu for the second time in a web view, a new
+ WebContextMenuProxy is created and the previous one is
+ destroyed. We were setting the active context menu of the WebView
+ in the constructor of WebContextMenuProxy, and unsetting it in the
+ destructor. Now the constructor of the new WebContextMenuProxy
+ happens before the destructor of the current one that unsets the
+ WebView active context menu. This patch simply makes the web view
+ unset its active context menu when it's unmapped and a new one
+ hasn't been set.
+
+ * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+ (activeContextMenuUnmapped):
+ (webkitWebViewBaseSetActiveContextMenuProxy):
+ * UIProcess/gtk/WebContextMenuProxyGtk.cpp:
+ (WebKit::WebContextMenuProxyGtk::~WebContextMenuProxyGtk):
+
2015-10-22 Hunseop Jeong <[email protected]>
[GTK] Try to fix the build after r191402.
Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp (191448 => 191449)
--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp 2015-10-22 08:56:01 UTC (rev 191448)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp 2015-10-22 09:49:33 UTC (rev 191449)
@@ -1250,9 +1250,16 @@
gtk_widget_queue_resize_no_redraw(GTK_WIDGET(webkitWebViewBase));
}
+static void activeContextMenuUnmapped(GtkMenu* menu, WebKitWebViewBase* webViewBase)
+{
+ if (webViewBase->priv->activeContextMenuProxy && webViewBase->priv->activeContextMenuProxy->gtkMenu() == menu)
+ webViewBase->priv->activeContextMenuProxy = nullptr;
+}
+
void webkitWebViewBaseSetActiveContextMenuProxy(WebKitWebViewBase* webkitWebViewBase, WebContextMenuProxyGtk* contextMenuProxy)
{
webkitWebViewBase->priv->activeContextMenuProxy = contextMenuProxy;
+ g_signal_connect_object(contextMenuProxy->gtkMenu(), "unmap", G_CALLBACK(activeContextMenuUnmapped), webkitWebViewBase, static_cast<GConnectFlags>(0));
}
WebContextMenuProxyGtk* webkitWebViewBaseGetActiveContextMenuProxy(WebKitWebViewBase* webkitWebViewBase)
Modified: trunk/Source/WebKit2/UIProcess/gtk/WebContextMenuProxyGtk.cpp (191448 => 191449)
--- trunk/Source/WebKit2/UIProcess/gtk/WebContextMenuProxyGtk.cpp 2015-10-22 08:56:01 UTC (rev 191448)
+++ trunk/Source/WebKit2/UIProcess/gtk/WebContextMenuProxyGtk.cpp 2015-10-22 09:49:33 UTC (rev 191449)
@@ -189,7 +189,6 @@
g_signal_handler_disconnect(handler.value, handler.key);
m_signalHandlers.clear();
- webkitWebViewBaseSetActiveContextMenuProxy(WEBKIT_WEB_VIEW_BASE(m_webView), nullptr);
m_menu.setPlatformDescription(nullptr);
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes