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
This commit is contained in:
Ivan Furs 2016-12-27 16:20:58 +02:00 committed by Mykyta Biliavskyi
parent ea66c8302a
commit 3df48e281e
1 changed files with 4 additions and 5 deletions

View File

@ -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;