From: cedric Date: Tue, 28 Jun 2011 14:35:21 +0000 (+0000) Subject: ethumb: fix various source of misusage. X-Git-Tag: 2.0_alpha~9^2~32 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2444ca24d32fd4700642565b3659c9314f2ed457;p=framework%2Fuifw%2Fethumb.git ethumb: fix various source of misusage. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ethumb@60760 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/bin/ethumbd_child.c b/src/bin/ethumbd_child.c index aeae424..88b112e 100644 --- a/src/bin/ethumbd_child.c +++ b/src/bin/ethumbd_child.c @@ -219,7 +219,7 @@ _ec_op_generated_cb(void *data, Ethumb *e, Eina_Bool success) const char *thumb_path, *thumb_key; int size_path, size_key, size_cmd; - DBG("thumb generated!"); + DBG("thumb generated (%i)!", success); ethumb_thumb_path_get(e, &thumb_path, &thumb_key); if (!thumb_path) diff --git a/src/lib/Ethumb.c b/src/lib/Ethumb.c index fb9ce90..eb2e0ca 100644 --- a/src/lib/Ethumb.c +++ b/src/lib/Ethumb.c @@ -775,6 +775,9 @@ ethumb_file_set(Ethumb *e, const char *path, const char *key) char buf[PATH_MAX]; EINA_SAFETY_ON_NULL_RETURN_VAL(e, 0); + eina_stringshare_replace(&e->thumb_path, NULL); + eina_stringshare_replace(&e->thumb_key, NULL); + DBG("ethumb=%p, path=%s, key=%s", e, path ? path : "", key ? key : ""); if (path && access(path, R_OK)) { @@ -785,8 +788,6 @@ ethumb_file_set(Ethumb *e, const char *path, const char *key) path = _ethumb_build_absolute_path(path, buf); eina_stringshare_replace(&e->src_path, path); eina_stringshare_replace(&e->src_key, key); - eina_stringshare_replace(&e->thumb_path, NULL); - eina_stringshare_replace(&e->thumb_key, NULL); return EINA_TRUE; } @@ -1513,18 +1514,21 @@ ethumb_generate(Ethumb *e, Ethumb_Generate_Cb finished_cb, const void *data, Ein { ERR("no file set."); ethumb_finished_callback_call(e, 0); - return EINA_TRUE; + return EINA_FALSE; } r = _ethumb_plugin_generate(e); if (r) - return EINA_TRUE; + { + ethumb_finished_callback_call(e, r); + return EINA_TRUE; + } if (!_ethumb_image_load(e)) { ERR("could not load input image."); ethumb_finished_callback_call(e, 0); - return EINA_TRUE; + return EINA_FALSE; } r = ethumb_image_save(e); diff --git a/src/lib/client/Ethumb_Client.c b/src/lib/client/Ethumb_Client.c index 595c58b..aaffa20 100644 --- a/src/lib/client/Ethumb_Client.c +++ b/src/lib/client/Ethumb_Client.c @@ -181,6 +181,7 @@ struct _Ethumb_Async_Exists EINA_REFCOUNT; Eina_Bool exists : 1; + Eina_Bool cancel : 1; }; struct _Ethumb_Async_Exists_Cb @@ -354,6 +355,7 @@ _ethumb_async_delete(void *data) static void _ethumb_async_cancel(Ethumb_Async_Exists *async) { + async->cancel = EINA_TRUE; ecore_thread_cancel(async->thread); } @@ -1133,10 +1135,11 @@ _ethumb_client_generated_cb(void *data, DBusMessage *msg) if (found) { client->pending_gen = eina_list_remove_list(client->pending_gen, l); - pending->generated_cb(pending->data, client, id, - pending->file, pending->key, - pending->thumb, pending->thumb_key, - success); + if (pending->generated_cb) + pending->generated_cb(pending->data, client, id, + pending->file, pending->key, + pending->thumb, pending->thumb_key, + success); if (pending->free_data) pending->free_data(pending->data); eina_stringshare_del(pending->file); @@ -2174,6 +2177,7 @@ ethumb_client_thumb_exists(Ethumb_Client *client, Ethumb_Client_Thumb_Exists_Cb async->source = client; EINA_REFCOUNT_REF(async->source); async->exists = EINA_FALSE; + async->cancel = EINA_FALSE; async->callbacks = eina_list_append(NULL, cb); @@ -2224,7 +2228,7 @@ ethumb_client_thumb_exists_check(Ethumb_Exists *exists) if (!async) return EINA_TRUE; - if (async->callbacks) return EINA_FALSE; + if (async->callbacks || async->cancel) return EINA_FALSE; return ecore_thread_check(async->thread); }