bu5hm4n pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=65afddf2ae794e18bdd8ea49a9879f2096647e2c

commit 65afddf2ae794e18bdd8ea49a9879f2096647e2c
Author: Mike Blumenkrantz <[email protected]>
Date:   Tue Jun 26 18:15:10 2018 -0400

    eio/fallback: do not modify the children hash while iterating it
    
    this is invalid use of the hash api and will cause a crash
    
    @fix
    
    Differential Revision: https://phab.enlightenment.org/D6444
---
 src/lib/eio/eio_monitor_poll.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/lib/eio/eio_monitor_poll.c b/src/lib/eio/eio_monitor_poll.c
index 36e36f6ee4..392b2151e9 100644
--- a/src/lib/eio/eio_monitor_poll.c
+++ b/src/lib/eio/eio_monitor_poll.c
@@ -194,8 +194,10 @@ _eio_monitor_fallback_heavy_cb(void *data, Ecore_Thread 
*thread)
    if (backend->initialised && !ecore_thread_check(thread))
      {
         Eina_Hash_Tuple *tuple;
+        Eina_Array *arr;
 
         it = eina_hash_iterator_tuple_new(backend->children);
+        arr = eina_array_new(1);
         ecore_thread_main_loop_begin();
 
         EINA_ITERATOR_FOREACH(it, tuple)
@@ -206,11 +208,14 @@ _eio_monitor_fallback_heavy_cb(void *data, Ecore_Thread 
*thread)
                {
                   _eio_monitor_send(backend->parent, tuple->key,
                                     eio_file_is_dir(&cmp->buffer) ? 
EIO_MONITOR_DIRECTORY_DELETED : EIO_MONITOR_FILE_DELETED);
-                  eina_hash_del(backend->children, tuple->key, tuple->data);
+                  eina_array_push(arr, tuple->key);
                }
           }
 
         ecore_thread_main_loop_end();
+        while (eina_array_count(arr))
+          eina_hash_del_by_key(backend->children, eina_array_pop);
+        eina_array_free(arr);
         eina_iterator_free(it);
      }
 

-- 


Reply via email to