Fix a bug with using Eio_File handler in main callback.

When using eio_file_stat_ls() (or any other exposing Eio_File *handler),
it will not be possible to use it from the main callback due to eio
freeing data too fast from the thread.

Moved frees from _eio_file_eina_ls_heavy() to eio_async_end() to be
sure that all the calls to main callback are over.
This implied adding the Eina_Iterator from eina_file_stat_ls to
the _Eio_File_Ls structure.
This commit is contained in:
Guillaume Friloux 2014-10-09 21:41:55 +02:00 committed by zmike
parent 1bea224203
commit 73a23401ef
2 changed files with 4 additions and 4 deletions

View File

@ -176,9 +176,7 @@ _eio_file_eina_ls_heavy(Ecore_Thread *thread, Eio_File_Direct_Ls *async, Eina_It
if (pack) ecore_thread_feedback(thread, pack);
eio_file_container_set(&async->ls.common, NULL);
eina_iterator_free(ls);
async->ls.ls = ls;
}
static void
@ -468,7 +466,8 @@ eio_async_end(void *data, Ecore_Thread *thread EINA_UNUSED)
Eio_File_Ls *async = data;
async->common.done_cb((void*) async->common.data, &async->common);
eio_file_container_set(&async->common, NULL);
eina_iterator_free(async->ls);
eio_async_free(async);
}

View File

@ -275,6 +275,7 @@ struct _Eio_File_Ls
{
Eio_File common;
const char *directory;
Eina_Iterator *ls;
};
struct _Eio_File_Direct_Ls