From e12587619b54c4cbd3f82469e74d3b1453c2cb9d Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 20 Jul 2009 18:19:50 -0400 Subject: [PATCH] Fix reference counting of textures loaded via _load_uri_sync Avoid double unref, fixes image previews. --- src/shell-texture-cache.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/shell-texture-cache.c b/src/shell-texture-cache.c index 69b2d7776..f8249c07f 100644 --- a/src/shell-texture-cache.c +++ b/src/shell-texture-cache.c @@ -845,17 +845,17 @@ shell_texture_cache_load_uri_sync (ShellTextureCache *cache, texdata = pixbuf_to_cogl_handle (pixbuf); g_object_unref (pixbuf); + clutter_texture_set_cogl_texture (texture, texdata); + if (policy == SHELL_TEXTURE_CACHE_POLICY_FOREVER) { g_hash_table_insert (cache->priv->keyed_cache, cache_key_dup (&key), texdata); } else - { - cogl_handle_unref (texdata); - } + cogl_handle_unref (texdata); } - - clutter_texture_set_cogl_texture (texture, texdata); + else + clutter_texture_set_cogl_texture (texture, texdata); return CLUTTER_ACTOR (texture); }