st: Keep weak ref on texture cache bound texture source
We don't keep any ref on it, so it might leave us with a dangling pointer here. Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3491 Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1672>
This commit is contained in:
parent
7a2e629bd0
commit
87558efbf1
@ -798,6 +798,10 @@ st_texture_cache_bind_weak_notify (gpointer data,
|
|||||||
{
|
{
|
||||||
StTextureCachePropertyBind *bind = data;
|
StTextureCachePropertyBind *bind = data;
|
||||||
bind->weakref_active = FALSE;
|
bind->weakref_active = FALSE;
|
||||||
|
if (G_OBJECT (bind->image) != source_location)
|
||||||
|
g_object_weak_unref (G_OBJECT (bind->image), st_texture_cache_bind_weak_notify, bind);
|
||||||
|
if (bind->source != source_location)
|
||||||
|
g_object_weak_unref (G_OBJECT (bind->source), st_texture_cache_bind_weak_notify, bind);
|
||||||
g_signal_handler_disconnect (bind->source, bind->notify_signal_id);
|
g_signal_handler_disconnect (bind->source, bind->notify_signal_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -805,8 +809,13 @@ static void
|
|||||||
st_texture_cache_free_bind (gpointer data)
|
st_texture_cache_free_bind (gpointer data)
|
||||||
{
|
{
|
||||||
StTextureCachePropertyBind *bind = data;
|
StTextureCachePropertyBind *bind = data;
|
||||||
|
|
||||||
if (bind->weakref_active)
|
if (bind->weakref_active)
|
||||||
|
{
|
||||||
g_object_weak_unref (G_OBJECT (bind->image), st_texture_cache_bind_weak_notify, bind);
|
g_object_weak_unref (G_OBJECT (bind->image), st_texture_cache_bind_weak_notify, bind);
|
||||||
|
g_object_weak_unref (G_OBJECT (bind->source), st_texture_cache_bind_weak_notify, bind);
|
||||||
|
}
|
||||||
|
|
||||||
g_free (bind);
|
g_free (bind);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -840,6 +849,7 @@ st_texture_cache_bind_cairo_surface_property (StTextureCache *cache,
|
|||||||
st_texture_cache_reset_texture (bind, property_name);
|
st_texture_cache_reset_texture (bind, property_name);
|
||||||
|
|
||||||
g_object_weak_ref (G_OBJECT (bind->image), st_texture_cache_bind_weak_notify, bind);
|
g_object_weak_ref (G_OBJECT (bind->image), st_texture_cache_bind_weak_notify, bind);
|
||||||
|
g_object_weak_ref (G_OBJECT (bind->source), st_texture_cache_bind_weak_notify, bind);
|
||||||
bind->weakref_active = TRUE;
|
bind->weakref_active = TRUE;
|
||||||
|
|
||||||
notify_key = g_strdup_printf ("notify::%s", property_name);
|
notify_key = g_strdup_printf ("notify::%s", property_name);
|
||||||
|
Loading…
Reference in New Issue
Block a user