summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2018-06-26 18:15:10 -0400
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2018-06-28 18:08:45 +0200
commit65afddf2ae794e18bdd8ea49a9879f2096647e2c (patch)
treef5b03c84cd6a5a2632f3a97fe3395f0c2e59e827
parentf41b9ea204394fea81fe709e07fdf31db6dfc2b6 (diff)
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
-rw-r--r--src/lib/eio/eio_monitor_poll.c7
1 files changed, 6 insertions, 1 deletions
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)
194 if (backend->initialised && !ecore_thread_check(thread)) 194 if (backend->initialised && !ecore_thread_check(thread))
195 { 195 {
196 Eina_Hash_Tuple *tuple; 196 Eina_Hash_Tuple *tuple;
197 Eina_Array *arr;
197 198
198 it = eina_hash_iterator_tuple_new(backend->children); 199 it = eina_hash_iterator_tuple_new(backend->children);
200 arr = eina_array_new(1);
199 ecore_thread_main_loop_begin(); 201 ecore_thread_main_loop_begin();
200 202
201 EINA_ITERATOR_FOREACH(it, tuple) 203 EINA_ITERATOR_FOREACH(it, tuple)
@@ -206,11 +208,14 @@ _eio_monitor_fallback_heavy_cb(void *data, Ecore_Thread *thread)
206 { 208 {
207 _eio_monitor_send(backend->parent, tuple->key, 209 _eio_monitor_send(backend->parent, tuple->key,
208 eio_file_is_dir(&cmp->buffer) ? EIO_MONITOR_DIRECTORY_DELETED : EIO_MONITOR_FILE_DELETED); 210 eio_file_is_dir(&cmp->buffer) ? EIO_MONITOR_DIRECTORY_DELETED : EIO_MONITOR_FILE_DELETED);
209 eina_hash_del(backend->children, tuple->key, tuple->data); 211 eina_array_push(arr, tuple->key);
210 } 212 }
211 } 213 }
212 214
213 ecore_thread_main_loop_end(); 215 ecore_thread_main_loop_end();
216 while (eina_array_count(arr))
217 eina_hash_del_by_key(backend->children, eina_array_pop);
218 eina_array_free(arr);
214 eina_iterator_free(it); 219 eina_iterator_free(it);
215 } 220 }
216 221