Don't leak when loading an already-cached item
A previous patch fixed a leak when loading items which shouldn't be cached, but we also had a leak if two requests for the same item were outstanding. In that case we load the pixbuf twice, but should discard subsequent loads when we notice we've already cached it. https://bugzilla.gnome.org/show_bug.cgi?id=595321
This commit is contained in:
parent
4876474be3
commit
0143512e00
@ -710,7 +710,7 @@ on_pixbuf_loaded (GObject *source,
|
|||||||
AsyncTextureLoadData *data;
|
AsyncTextureLoadData *data;
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
CoglHandle texdata;
|
CoglHandle texdata = NULL;
|
||||||
CacheKey *key;
|
CacheKey *key;
|
||||||
|
|
||||||
data = user_data;
|
data = user_data;
|
||||||
@ -743,20 +743,20 @@ on_pixbuf_loaded (GObject *source,
|
|||||||
|
|
||||||
if (!g_hash_table_lookup_extended (cache->priv->keyed_cache, key,
|
if (!g_hash_table_lookup_extended (cache->priv->keyed_cache, key,
|
||||||
&orig_key, &value))
|
&orig_key, &value))
|
||||||
|
{
|
||||||
|
cogl_handle_ref (texdata);
|
||||||
g_hash_table_insert (cache->priv->keyed_cache, key,
|
g_hash_table_insert (cache->priv->keyed_cache, key,
|
||||||
texdata);
|
texdata);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
cache_key_destroy (key);
|
cache_key_destroy (key);
|
||||||
|
}
|
||||||
|
|
||||||
set_texture_cogl_texture (data->texture, texdata);
|
set_texture_cogl_texture (data->texture, texdata);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
set_texture_cogl_texture (data->texture, texdata);
|
|
||||||
cogl_handle_unref (texdata);
|
|
||||||
}
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
if (texdata)
|
||||||
|
cogl_handle_unref (texdata);
|
||||||
if (data->icon)
|
if (data->icon)
|
||||||
{
|
{
|
||||||
gtk_icon_info_free (data->icon_info);
|
gtk_icon_info_free (data->icon_info);
|
||||||
|
Loading…
Reference in New Issue
Block a user