From 3df48e281e44501b797c012c4bef32cd0090fa9c Mon Sep 17 00:00:00 2001 From: Ivan Furs Date: Tue, 27 Dec 2016 16:20:58 +0200 Subject: [PATCH] eio: Correct deletion backend Summary: This patch fixes the bug Fileselector. When backend is deleted need to remove event handler from the list. This commit adds ecore_main_win32_handler_del for correct clean handlers for cases when monitor backend was created by eio_monitor_backend_add(Windows method) or eio_monitor_fallback_add. To remove them needed to use eio_monitor_backend_del(Windows method) or eio_monitor_fallback_del. To identify the method which should free backend was added flag monitor->fallback instead of using static _eio_monitor_win32_native. This solves conflicts if 2 monitors was created and the second monitor changed the _eio_monitor_win32_native variable value. When 1 monitor removed it will be deleted correctly . @fix Reviewers: NikaWhite Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4518 --- src/lib/eio/eio_monitor_win32.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/lib/eio/eio_monitor_win32.c b/src/lib/eio/eio_monitor_win32.c index 60f9aa35c4..05374f1c76 100644 --- a/src/lib/eio/eio_monitor_win32.c +++ b/src/lib/eio/eio_monitor_win32.c @@ -56,8 +56,6 @@ struct _Eio_Monitor_Backend Eio_Monitor_Win32_Watcher *watcher_parent; }; -static Eina_Bool _eio_monitor_win32_native = EINA_FALSE; - static Eina_Bool _eio_monitor_win32_cb(void *data, Ecore_Win32_Handler *wh EINA_UNUSED) { @@ -313,6 +311,7 @@ _eio_monitor_win32_watcher_free(Eio_Monitor_Win32_Watcher *w) { if (!w) return; + ecore_main_win32_handler_del(w->h); eina_stringshare_del(w->file); eina_stringshare_del(w->current); CloseHandle(w->event); @@ -402,7 +401,7 @@ void eio_monitor_backend_add(Eio_Monitor *monitor) if (!backend->watcher_parent) goto free_backend_dir; - _eio_monitor_win32_native = EINA_TRUE; + monitor->fallback = EINA_FALSE; monitor->backend = backend; eina_stringshare_del(current); @@ -418,13 +417,13 @@ void eio_monitor_backend_add(Eio_Monitor *monitor) free(backend); fallback: INF("falling back to poll monitoring"); - _eio_monitor_win32_native = EINA_FALSE; + monitor->fallback = EINA_TRUE; eio_monitor_fallback_add(monitor); } void eio_monitor_backend_del(Eio_Monitor *monitor) { - if (!_eio_monitor_win32_native) + if (monitor->fallback) { eio_monitor_fallback_del(monitor); return;