From a24999b7a317483d20a4df0abdf04f40f9bf95ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 17 Apr 2018 04:43:34 -0500 Subject: [PATCH] st-texture-cache: Don't add NULL textures to cache This might cause a crash when cleaning up the cache as the hash table has cogl_object_unref as DestroyNotify function but that assumes that the passed object is a valid CoglObject. Fixes: #210 --- src/st/st-texture-cache.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/st/st-texture-cache.c b/src/st/st-texture-cache.c index e8a832df0..58185120e 100644 --- a/src/st/st-texture-cache.c +++ b/src/st/st-texture-cache.c @@ -520,6 +520,8 @@ finish_texture_load (AsyncTextureLoadData *data, goto out; texdata = pixbuf_to_cogl_texture (pixbuf); + if (!texdata) + goto out; if (data->policy != ST_TEXTURE_CACHE_POLICY_NONE) { @@ -1273,6 +1275,9 @@ st_texture_cache_load_file_sync_to_cogl_texture (StTextureCache *cache, texdata = pixbuf_to_cogl_texture (pixbuf); g_object_unref (pixbuf); + if (!texdata) + goto out; + if (policy == ST_TEXTURE_CACHE_POLICY_FOREVER) { cogl_object_ref (texdata);