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;
|
const char *thumb_path, *thumb_key;
|
||||||
int size_path, size_key, size_cmd;
|
int size_path, size_key, size_cmd;
|
||||||
|
|
||||||
DBG("thumb generated!");
|
DBG("thumb generated (%i)!", success);
|
||||||
ethumb_thumb_path_get(e, &thumb_path, &thumb_key);
|
ethumb_thumb_path_get(e, &thumb_path, &thumb_key);
|
||||||
|
|
||||||
if (!thumb_path)
|
if (!thumb_path)
|
||||||
|
|
|
@ -775,6 +775,9 @@ ethumb_file_set(Ethumb *e, const char *path, const char *key)
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(e, 0);
|
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 : "");
|
DBG("ethumb=%p, path=%s, key=%s", e, path ? path : "", key ? key : "");
|
||||||
if (path && access(path, R_OK))
|
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);
|
path = _ethumb_build_absolute_path(path, buf);
|
||||||
eina_stringshare_replace(&e->src_path, path);
|
eina_stringshare_replace(&e->src_path, path);
|
||||||
eina_stringshare_replace(&e->src_key, key);
|
eina_stringshare_replace(&e->src_key, key);
|
||||||
eina_stringshare_replace(&e->thumb_path, NULL);
|
|
||||||
eina_stringshare_replace(&e->thumb_key, NULL);
|
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1513,18 +1514,21 @@ ethumb_generate(Ethumb *e, Ethumb_Generate_Cb finished_cb, const void *data, Ein
|
||||||
{
|
{
|
||||||
ERR("no file set.");
|
ERR("no file set.");
|
||||||
ethumb_finished_callback_call(e, 0);
|
ethumb_finished_callback_call(e, 0);
|
||||||
return EINA_TRUE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = _ethumb_plugin_generate(e);
|
r = _ethumb_plugin_generate(e);
|
||||||
if (r)
|
if (r)
|
||||||
return EINA_TRUE;
|
{
|
||||||
|
ethumb_finished_callback_call(e, r);
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
if (!_ethumb_image_load(e))
|
if (!_ethumb_image_load(e))
|
||||||
{
|
{
|
||||||
ERR("could not load input image.");
|
ERR("could not load input image.");
|
||||||
ethumb_finished_callback_call(e, 0);
|
ethumb_finished_callback_call(e, 0);
|
||||||
return EINA_TRUE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = ethumb_image_save(e);
|
r = ethumb_image_save(e);
|
||||||
|
|
|
@ -181,6 +181,7 @@ struct _Ethumb_Async_Exists
|
||||||
EINA_REFCOUNT;
|
EINA_REFCOUNT;
|
||||||
|
|
||||||
Eina_Bool exists : 1;
|
Eina_Bool exists : 1;
|
||||||
|
Eina_Bool cancel : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Ethumb_Async_Exists_Cb
|
struct _Ethumb_Async_Exists_Cb
|
||||||
|
@ -354,6 +355,7 @@ _ethumb_async_delete(void *data)
|
||||||
static void
|
static void
|
||||||
_ethumb_async_cancel(Ethumb_Async_Exists *async)
|
_ethumb_async_cancel(Ethumb_Async_Exists *async)
|
||||||
{
|
{
|
||||||
|
async->cancel = EINA_TRUE;
|
||||||
ecore_thread_cancel(async->thread);
|
ecore_thread_cancel(async->thread);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1133,10 +1135,11 @@ _ethumb_client_generated_cb(void *data, DBusMessage *msg)
|
||||||
if (found)
|
if (found)
|
||||||
{
|
{
|
||||||
client->pending_gen = eina_list_remove_list(client->pending_gen, l);
|
client->pending_gen = eina_list_remove_list(client->pending_gen, l);
|
||||||
pending->generated_cb(pending->data, client, id,
|
if (pending->generated_cb)
|
||||||
pending->file, pending->key,
|
pending->generated_cb(pending->data, client, id,
|
||||||
pending->thumb, pending->thumb_key,
|
pending->file, pending->key,
|
||||||
success);
|
pending->thumb, pending->thumb_key,
|
||||||
|
success);
|
||||||
if (pending->free_data)
|
if (pending->free_data)
|
||||||
pending->free_data(pending->data);
|
pending->free_data(pending->data);
|
||||||
eina_stringshare_del(pending->file);
|
eina_stringshare_del(pending->file);
|
||||||
|
@ -2174,6 +2177,7 @@ ethumb_client_thumb_exists(Ethumb_Client *client, Ethumb_Client_Thumb_Exists_Cb
|
||||||
async->source = client;
|
async->source = client;
|
||||||
EINA_REFCOUNT_REF(async->source);
|
EINA_REFCOUNT_REF(async->source);
|
||||||
async->exists = EINA_FALSE;
|
async->exists = EINA_FALSE;
|
||||||
|
async->cancel = EINA_FALSE;
|
||||||
|
|
||||||
async->callbacks = eina_list_append(NULL, cb);
|
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) return EINA_TRUE;
|
||||||
|
|
||||||
if (async->callbacks) return EINA_FALSE;
|
if (async->callbacks || async->cancel) return EINA_FALSE;
|
||||||
|
|
||||||
return ecore_thread_check(async->thread);
|
return ecore_thread_check(async->thread);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue