discomfitor pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=73a23401ef007cd80297df6546484f3e8a065d2c

commit 73a23401ef007cd80297df6546484f3e8a065d2c
Author: Guillaume Friloux <[email protected]>
Date:   Thu Oct 9 21:41:55 2014 +0200

    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.
---
 src/lib/eio/eio_file.c    | 7 +++----
 src/lib/eio/eio_private.h | 1 +
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/lib/eio/eio_file.c b/src/lib/eio/eio_file.c
index 0a17dbd..2e1cd6f 100644
--- a/src/lib/eio/eio_file.c
+++ b/src/lib/eio/eio_file.c
@@ -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);
 }
 
diff --git a/src/lib/eio/eio_private.h b/src/lib/eio/eio_private.h
index 8fd9e7e..8502713 100644
--- a/src/lib/eio/eio_private.h
+++ b/src/lib/eio/eio_private.h
@@ -275,6 +275,7 @@ struct _Eio_File_Ls
 {
    Eio_File common;
    const char *directory;
+   Eina_Iterator *ls;
 };
 
 struct _Eio_File_Direct_Ls

-- 


Reply via email to