mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-14 14:20:21 +00:00
gpu: Fix texture eviction
If we gc a cached texture for which the GdkTexture is still alive, the cached texture object will remain accessible via the render data, so need to make sure not to leave a dangling pointer behind here.
This commit is contained in:
parent
bd9ea05ebb
commit
4d92093c67
@ -200,8 +200,8 @@ gsk_gpu_cached_texture_free (GskGpuDevice *device,
|
||||
gboolean texture_still_alive;
|
||||
|
||||
texture_still_alive = g_atomic_pointer_exchange (&self->texture, NULL) != NULL;
|
||||
g_object_unref (self->image);
|
||||
|
||||
g_clear_object (&self->image);
|
||||
|
||||
if (!texture_still_alive)
|
||||
g_free (self);
|
||||
}
|
||||
@ -663,10 +663,8 @@ gsk_gpu_device_lookup_texture_image (GskGpuDevice *self,
|
||||
if (cache == NULL)
|
||||
cache = g_hash_table_lookup (priv->texture_cache, texture);
|
||||
|
||||
if (cache)
|
||||
{
|
||||
return g_object_ref (cache->image);
|
||||
}
|
||||
if (cache && cache->image)
|
||||
return g_object_ref (cache->image);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user