eio: avoid access after death of eio handler due to inotify triggering IN_IGNORED...
authorCedric Bail <cedric@osg.samsung.com>
Sat, 16 Jul 2016 00:02:03 +0000 (17:02 -0700)
committerCedric Bail <cedric@osg.samsung.com>
Sat, 16 Jul 2016 00:07:49 +0000 (17:07 -0700)
src/lib/eio/eio_monitor_inotify.c

index faa34b3..2222a56 100644 (file)
@@ -141,6 +141,9 @@ _eio_inotify_handler(void *data EINA_UNUSED, Ecore_Fd_Handler *fdh)
         if ((event_size + i) > size) break ;
         i += event_size;
 
+        // No need to waste time looking up for just destroyed handler
+        if ((event->mask & IN_IGNORED)) continue ;
+
         backend = eina_hash_find(_inotify_monitors, &event->wd);
         if (!backend) continue ;
         if (!backend->parent) continue ;
@@ -268,6 +271,8 @@ void eio_monitor_backend_del(Eio_Monitor *monitor)
    monitor->backend = NULL;
    if (!backend) return;
 
+   backend->parent = NULL;
+
    eina_hash_del(_inotify_monitors, &backend->hwnd, backend);
 }