Fix reference counting of textures loaded via _load_uri_sync

Avoid double unref, fixes image previews.
This commit is contained in:
Colin Walters 2009-07-20 18:19:50 -04:00
parent 8d9fc28872
commit e12587619b

View File

@ -845,17 +845,17 @@ shell_texture_cache_load_uri_sync (ShellTextureCache *cache,
texdata = pixbuf_to_cogl_handle (pixbuf); texdata = pixbuf_to_cogl_handle (pixbuf);
g_object_unref (pixbuf); g_object_unref (pixbuf);
clutter_texture_set_cogl_texture (texture, texdata);
if (policy == SHELL_TEXTURE_CACHE_POLICY_FOREVER) if (policy == SHELL_TEXTURE_CACHE_POLICY_FOREVER)
{ {
g_hash_table_insert (cache->priv->keyed_cache, cache_key_dup (&key), texdata); g_hash_table_insert (cache->priv->keyed_cache, cache_key_dup (&key), texdata);
} }
else else
{ cogl_handle_unref (texdata);
cogl_handle_unref (texdata);
}
} }
else
clutter_texture_set_cogl_texture (texture, texdata); clutter_texture_set_cogl_texture (texture, texdata);
return CLUTTER_ACTOR (texture); return CLUTTER_ACTOR (texture);
} }