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:
@ -710,7 +710,7 @@ on_pixbuf_loaded (GObject *source,
|
||||
AsyncTextureLoadData *data;
|
||||
GdkPixbuf *pixbuf;
|
||||
GError *error = NULL;
|
||||
CoglHandle texdata;
|
||||
CoglHandle texdata = NULL;
|
||||
CacheKey *key;
|
||||
|
||||
data = user_data;
|
||||
@ -743,20 +743,20 @@ on_pixbuf_loaded (GObject *source,
|
||||
|
||||
if (!g_hash_table_lookup_extended (cache->priv->keyed_cache, key,
|
||||
&orig_key, &value))
|
||||
g_hash_table_insert (cache->priv->keyed_cache, key,
|
||||
texdata);
|
||||
{
|
||||
cogl_handle_ref (texdata);
|
||||
g_hash_table_insert (cache->priv->keyed_cache, key,
|
||||
texdata);
|
||||
}
|
||||
else
|
||||
cache_key_destroy (key);
|
||||
}
|
||||
|
||||
set_texture_cogl_texture (data->texture, texdata);
|
||||
}
|
||||
else
|
||||
{
|
||||
set_texture_cogl_texture (data->texture, texdata);
|
||||
cogl_handle_unref (texdata);
|
||||
}
|
||||
set_texture_cogl_texture (data->texture, texdata);
|
||||
|
||||
out:
|
||||
if (texdata)
|
||||
cogl_handle_unref (texdata);
|
||||
if (data->icon)
|
||||
{
|
||||
gtk_icon_info_free (data->icon_info);
|
||||
|
Reference in New Issue
Block a user