summaryrefslogtreecommitdiff
path: root/legacy/ethumb
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2011-08-09 20:36:28 +0000
committerCedric BAIL <cedric.bail@free.fr>2011-08-09 20:36:28 +0000
commit77851c1891c93afa2845988329d3456c6860e014 (patch)
tree6b706d17d8760385dd605f0ce8053b5c1d40ca6e /legacy/ethumb
parentfc80ec34c2268f42f0405fb5b38e7a5b0cfceba1 (diff)
ethumb: fix race condition and memory leak.
NOTE: that's a first obvious patch thanks to Gustavo reviews. More work needed, but some decision should be discussed first. SVN revision: 62265
Diffstat (limited to 'legacy/ethumb')
-rw-r--r--legacy/ethumb/src/lib/client/Ethumb_Client.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/legacy/ethumb/src/lib/client/Ethumb_Client.c b/legacy/ethumb/src/lib/client/Ethumb_Client.c
index 5ccb49efe2..c9edebae14 100644
--- a/legacy/ethumb/src/lib/client/Ethumb_Client.c
+++ b/legacy/ethumb/src/lib/client/Ethumb_Client.c
@@ -610,7 +610,10 @@ _ethumb_client_exists_end(void *data, Ecore_Thread *thread __UNUSED__)
610 async->source->ethumb_dirty = ethumb_cmp(tmp, async->dup); 610 async->source->ethumb_dirty = ethumb_cmp(tmp, async->dup);
611 611
612 EINA_LIST_FREE(async->callbacks, cb) 612 EINA_LIST_FREE(async->callbacks, cb)
613 cb->exists_cb(async->source, (Ethumb_Exists*) async, async->exists, (void*) cb->data); 613 {
614 cb->exists_cb(async->source, (Ethumb_Exists*) async, async->exists, (void*) cb->data);
615 free(cb);
616 }
614 617
615 async->source->ethumb = tmp; 618 async->source->ethumb = tmp;
616 async->thread = NULL; 619 async->thread = NULL;
@@ -2144,6 +2147,7 @@ ethumb_client_thumb_exists(Ethumb_Client *client, Ethumb_Client_Thumb_Exists_Cb
2144{ 2147{
2145 Ethumb_Async_Exists_Cb *cb; 2148 Ethumb_Async_Exists_Cb *cb;
2146 Ethumb_Async_Exists *async; 2149 Ethumb_Async_Exists *async;
2150 Ecore_Thread *t;
2147 2151
2148 EINA_SAFETY_ON_NULL_RETURN_VAL(client, NULL); 2152 EINA_SAFETY_ON_NULL_RETURN_VAL(client, NULL);
2149 2153
@@ -2182,11 +2186,13 @@ ethumb_client_thumb_exists(Ethumb_Client *client, Ethumb_Client_Thumb_Exists_Cb
2182 async->callbacks = eina_list_append(NULL, cb); 2186 async->callbacks = eina_list_append(NULL, cb);
2183 2187
2184 EINA_REFCOUNT_INIT(async); 2188 EINA_REFCOUNT_INIT(async);
2185 async->thread = ecore_thread_run(_ethumb_client_exists_heavy, 2189 t = ecore_thread_run(_ethumb_client_exists_heavy,
2186 _ethumb_client_exists_end, 2190 _ethumb_client_exists_end,
2187 _ethumb_client_exists_end, 2191 _ethumb_client_exists_end,
2188 async); 2192 async);
2193 if (!t) return NULL;
2189 2194
2195 async->thread = t;
2190 eina_hash_direct_add(_exists_request, async->dup, async); 2196 eina_hash_direct_add(_exists_request, async->dup, async);
2191 2197
2192 return (Ethumb_Exists*) async; 2198 return (Ethumb_Exists*) async;
@@ -2208,6 +2214,7 @@ ethumb_client_thumb_exists_cancel(Ethumb_Exists *exists, Ethumb_Client_Thumb_Exi
2208 if (cb->exists_cb == exists_cb && cb->data == data) 2214 if (cb->exists_cb == exists_cb && cb->data == data)
2209 { 2215 {
2210 async->callbacks = eina_list_remove_list(async->callbacks, l); 2216 async->callbacks = eina_list_remove_list(async->callbacks, l);
2217 free(cb);
2211 break; 2218 break;
2212 } 2219 }
2213 2220