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 <emanuele.aina@collabora.com>
Reviewed-by: André Magalhães's avatarAndré Magalhães <andre.magalhaes@collabora.co.uk>
Differential Revision: https://phabricator.apertis.org/D7030
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));
G_OBJECT_CLASS(webkit_web_clutter_view_parent_class)->dispose(object);
......@@ -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));
g_object_connect(G_OBJECT(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