forked from enlightenment/efl
elm_store.c: ELM_SAFE_FREE adoption.
I splited ELM_SAFE_FREE refactoring patches. One commit per each file as recommended. For the detail, please refer 3072dab12f12fe83fb5a628d15efd5cded11787f.
This commit is contained in:
parent
2f5ef21462
commit
c2747996da
|
@ -99,11 +99,7 @@ _store_cache_trim(Elm_Store *st)
|
||||||
if (!sti->fetched)
|
if (!sti->fetched)
|
||||||
{
|
{
|
||||||
eina_lock_release(&sti->lock);
|
eina_lock_release(&sti->lock);
|
||||||
if (sti->fetch_th)
|
ELM_SAFE_FREE(sti->fetch_th, ecore_thread_cancel);
|
||||||
{
|
|
||||||
ecore_thread_cancel(sti->fetch_th);
|
|
||||||
sti->fetch_th = NULL;
|
|
||||||
}
|
|
||||||
eina_lock_take(&sti->lock);
|
eina_lock_take(&sti->lock);
|
||||||
}
|
}
|
||||||
sti->fetched = EINA_FALSE;
|
sti->fetched = EINA_FALSE;
|
||||||
|
@ -122,25 +118,13 @@ _store_genlist_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__,
|
||||||
{
|
{
|
||||||
Elm_Store *st = data;
|
Elm_Store *st = data;
|
||||||
st->genlist = NULL;
|
st->genlist = NULL;
|
||||||
if (st->list_th)
|
ELM_SAFE_FREE(st->list_th, ecore_thread_cancel);
|
||||||
{
|
|
||||||
ecore_thread_cancel(st->list_th);
|
|
||||||
st->list_th = NULL;
|
|
||||||
}
|
|
||||||
st->realized = eina_list_free(st->realized);
|
st->realized = eina_list_free(st->realized);
|
||||||
while (st->items)
|
while (st->items)
|
||||||
{
|
{
|
||||||
Elm_Store_Item *sti = (Elm_Store_Item *)st->items;
|
Elm_Store_Item *sti = (Elm_Store_Item *)st->items;
|
||||||
if (sti->eval_job)
|
ELM_SAFE_FREE(sti->eval_job, ecore_job_del);
|
||||||
{
|
ELM_SAFE_FREE(sti->fetch_th, ecore_thread_cancel);
|
||||||
ecore_job_del(sti->eval_job);
|
|
||||||
sti->eval_job = NULL;
|
|
||||||
}
|
|
||||||
if (sti->fetch_th)
|
|
||||||
{
|
|
||||||
ecore_thread_cancel(sti->fetch_th);
|
|
||||||
sti->fetch_th = NULL;
|
|
||||||
}
|
|
||||||
if (sti->store->item.free) sti->store->item.free(sti);
|
if (sti->store->item.free) sti->store->item.free(sti);
|
||||||
eina_lock_take(&sti->lock);
|
eina_lock_take(&sti->lock);
|
||||||
if (sti->data)
|
if (sti->data)
|
||||||
|
@ -234,11 +218,7 @@ _store_item_eval(void *data)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (sti->fetch_th)
|
ELM_SAFE_FREE(sti->fetch_th, ecore_thread_cancel);
|
||||||
{
|
|
||||||
ecore_thread_cancel(sti->fetch_th);
|
|
||||||
sti->fetch_th = NULL;
|
|
||||||
}
|
|
||||||
_store_cache_trim(sti->store);
|
_store_cache_trim(sti->store);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -551,26 +531,14 @@ elm_store_free(Elm_Store *st)
|
||||||
{
|
{
|
||||||
void (*item_free)(Elm_Store_Item *);
|
void (*item_free)(Elm_Store_Item *);
|
||||||
if (!EINA_MAGIC_CHECK(st, ELM_STORE_MAGIC)) return;
|
if (!EINA_MAGIC_CHECK(st, ELM_STORE_MAGIC)) return;
|
||||||
if (st->list_th)
|
ELM_SAFE_FREE(st->list_th, ecore_thread_cancel);
|
||||||
{
|
|
||||||
ecore_thread_cancel(st->list_th);
|
|
||||||
st->list_th = NULL;
|
|
||||||
}
|
|
||||||
st->realized = eina_list_free(st->realized);
|
st->realized = eina_list_free(st->realized);
|
||||||
item_free = st->item.free;
|
item_free = st->item.free;
|
||||||
while (st->items)
|
while (st->items)
|
||||||
{
|
{
|
||||||
Elm_Store_Item *sti = (Elm_Store_Item *)st->items;
|
Elm_Store_Item *sti = (Elm_Store_Item *)st->items;
|
||||||
if (sti->eval_job)
|
ELM_SAFE_FREE(sti->eval_job, ecore_job_del);
|
||||||
{
|
ELM_SAFE_FREE(sti->fetch_th, ecore_thread_cancel);
|
||||||
ecore_job_del(sti->eval_job);
|
|
||||||
sti->eval_job = NULL;
|
|
||||||
}
|
|
||||||
if (sti->fetch_th)
|
|
||||||
{
|
|
||||||
ecore_thread_cancel(sti->fetch_th);
|
|
||||||
sti->fetch_th = NULL;
|
|
||||||
}
|
|
||||||
if (item_free) item_free(sti);
|
if (item_free) item_free(sti);
|
||||||
eina_lock_take(&sti->lock);
|
eina_lock_take(&sti->lock);
|
||||||
if (sti->data)
|
if (sti->data)
|
||||||
|
@ -622,11 +590,7 @@ elm_store_filesystem_directory_set(Elm_Store *store, const char *dir)
|
||||||
Elm_Store_Filesystem *st = (Elm_Store_Filesystem *)store;
|
Elm_Store_Filesystem *st = (Elm_Store_Filesystem *)store;
|
||||||
if (!EINA_MAGIC_CHECK(store, ELM_STORE_MAGIC)) return;
|
if (!EINA_MAGIC_CHECK(store, ELM_STORE_MAGIC)) return;
|
||||||
if (!EINA_MAGIC_CHECK(st, ELM_STORE_FILESYSTEM_MAGIC)) return;
|
if (!EINA_MAGIC_CHECK(st, ELM_STORE_FILESYSTEM_MAGIC)) return;
|
||||||
if (store->list_th)
|
ELM_SAFE_FREE(store->list_th, ecore_thread_cancel);
|
||||||
{
|
|
||||||
ecore_thread_cancel(store->list_th);
|
|
||||||
store->list_th = NULL;
|
|
||||||
}
|
|
||||||
if (!eina_stringshare_replace(&st->dir, dir)) return;
|
if (!eina_stringshare_replace(&st->dir, dir)) return;
|
||||||
store->list_th = ecore_thread_feedback_run(_store_filesystem_list_do,
|
store->list_th = ecore_thread_feedback_run(_store_filesystem_list_do,
|
||||||
_store_filesystem_list_update,
|
_store_filesystem_list_update,
|
||||||
|
|
Loading…
Reference in New Issue