Commit 40beb4b7 authored by Emanuele Aina's avatar Emanuele Aina

clutter: Fix ownership of the internal web view

The internal GTK-based web view was only owned by its offscreen window,
but we never cleared the pointer directly pointing to it, so if
::dispose was called more than once (which is fine) we ended up poking
at invalid memory, triggering the warning below:

   invalid unclassed pointer in cast to 'WebKitWebViewBase'

To avoid that, take and explict ref for the direct pointer and clear it
on ::dispose.
Signed-off-by: Emanuele Aina's avatarEmanuele Aina <>
Reviewed-by: André Magalhães's avatarAndré Magalhães <>
Differential Revision:
parent e8895b07
......@@ -754,6 +754,7 @@ static void webkitWebClutterViewDispose(GObject* object)
webkitWebViewBaseSetClutterView(WEBKIT_WEB_VIEW_BASE(priv->webView), nullptr);
g_clear_pointer(reinterpret_cast<gpointer*>(&priv->texture), reinterpret_cast<GDestroyNotify>(cogl_object_unref));
g_clear_pointer(reinterpret_cast<gpointer*>(&priv->webView), reinterpret_cast<GDestroyNotify>(gtk_widget_destroy));
g_clear_pointer(reinterpret_cast<gpointer*>(&priv->offscreenWindow), reinterpret_cast<GDestroyNotify>(gtk_widget_destroy));
......@@ -955,7 +956,7 @@ static void webkitWebClutterViewConstructed(GObject* object)
webkitWebViewBaseSetClutterView(WEBKIT_WEB_VIEW_BASE(webView), clutterView);
priv->webView = WEBKIT_WEB_VIEW(webView);
priv->webView = WEBKIT_WEB_VIEW(g_object_ref(webView));
"signal::create", G_CALLBACK(createCallback), clutterView,
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment