forked from enlightenment/efl
ethumb: fix various source of misusage.
SVN revision: 60760
This commit is contained in:
parent
2759f47524
commit
0408408e2a
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue