aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-12-23 21:07:23 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-12-23 21:13:47 +0900
commit27ac9a2be294f1e4f7ab9a6483e51d8eaaa3f440 (patch)
tree9d1b47709bf4e7c341e6a90f89fe69a99cfc740b
parentdocs: Group our API landing page by namespace (diff)
downloadefl-27ac9a2be294f1e4f7ab9a6483e51d8eaaa3f440.tar.gz
ecore main loop - fix fd handler clearning
so loop object destruction was clearing out fd handlers but those may be later deleted by destructors of child objects. so leave legacy fdh's and just remove them from the list
-rw-r--r--src/lib/ecore/ecore_main.c41
-rw-r--r--src/lib/ecore/efl_loop_handler.c28
2 files changed, 32 insertions, 37 deletions
diff --git a/src/lib/ecore/ecore_main.c b/src/lib/ecore/ecore_main.c
index 0084737221..00266b88f2 100644
--- a/src/lib/ecore/ecore_main.c
+++ b/src/lib/ecore/ecore_main.c
@@ -1040,11 +1040,13 @@ _ecore_main_loop_clear(Eo *obj, Efl_Loop_Data *pd)
}
#endif
}
+# ifdef HAVE_EPOLL
if (pd->epoll_fd >= 0)
{
close(pd->epoll_fd);
pd->epoll_fd = -1;
}
+#endif
if (pd->timer_fd >= 0)
{
close(pd->timer_fd);
@@ -1320,7 +1322,6 @@ _ecore_main_fd_handler_add(Eo *obj,
pd->fd_handlers = (Ecore_Fd_Handler *)
eina_inlist_append(EINA_INLIST_GET(pd->fd_handlers),
EINA_INLIST_GET(fdh));
-
return fdh;
}
@@ -1606,27 +1607,26 @@ _ecore_main_content_clear(Efl_Loop_Data *pd)
if (fdh->handler) efl_del(fdh->handler);
else
{
- ECORE_MAGIC_SET(fdh, ECORE_MAGIC_NONE);
- ecore_fd_handler_mp_free(fdh);
+// XXX: can't do this because this fd handler is legacy and might
+// be cleaned up later in object destructors
+// ECORE_MAGIC_SET(fdh, ECORE_MAGIC_NONE);
+// ecore_fd_handler_mp_free(fdh);
}
}
- if (pd)
- {
- if (pd->fd_handlers_with_buffer)
- pd->fd_handlers_with_buffer =
- eina_list_free(pd->fd_handlers_with_buffer);
- if (pd->fd_handlers_with_prep)
- pd->fd_handlers_with_prep =
- eina_list_free(pd->fd_handlers_with_prep);
- if (pd->file_fd_handlers)
- pd->file_fd_handlers =
- eina_list_free(pd->file_fd_handlers);
- if (pd->fd_handlers_to_delete)
- pd->fd_handlers_to_delete =
- eina_list_free(pd->fd_handlers_to_delete);
- pd->fd_handlers_to_call = NULL;
- pd->fd_handlers_to_call_current = NULL;
- }
+ if (pd->fd_handlers_with_buffer)
+ pd->fd_handlers_with_buffer =
+ eina_list_free(pd->fd_handlers_with_buffer);
+ if (pd->fd_handlers_with_prep)
+ pd->fd_handlers_with_prep =
+ eina_list_free(pd->fd_handlers_with_prep);
+ if (pd->file_fd_handlers)
+ pd->file_fd_handlers =
+ eina_list_free(pd->file_fd_handlers);
+ if (pd->fd_handlers_to_delete)
+ pd->fd_handlers_to_delete =
+ eina_list_free(pd->fd_handlers_to_delete);
+ pd->fd_handlers_to_call = NULL;
+ pd->fd_handlers_to_call_current = NULL;
pd->do_quit = 0;
@@ -1662,7 +1662,6 @@ _ecore_main_shutdown(void)
ERR("Calling ecore_shutdown() while still in the main loop!!!");
return;
}
- _ecore_main_content_clear(pd);
}
static void
diff --git a/src/lib/ecore/efl_loop_handler.c b/src/lib/ecore/efl_loop_handler.c
index 417e12d974..7615652b61 100644
--- a/src/lib/ecore/efl_loop_handler.c
+++ b/src/lib/ecore/efl_loop_handler.c
@@ -53,11 +53,15 @@ _handler_clear(Efl_Loop_Handler_Data *pd)
Efl_Loop_Data *loop = pd->loop_data;
if (pd->handler_fd)
- _ecore_main_fd_handler_del(obj, loop, pd->handler_fd);
+ {
+ _ecore_main_fd_handler_del(obj, loop, pd->handler_fd);
+ pd->handler_fd = NULL;
+ }
else if (pd->handler_win32)
- _ecore_main_win32_handler_del(obj, loop, pd->handler_win32);
- pd->handler_fd = NULL;
- pd->handler_win32 = NULL;
+ {
+ _ecore_main_win32_handler_del(obj, loop, pd->handler_win32);
+ pd->handler_win32 = NULL;
+ }
}
static Ecore_Fd_Handler_Flags
@@ -108,18 +112,10 @@ _handler_reset(Eo *obj, Efl_Loop_Handler_Data *pd)
_handler_active_update(obj, pd);
else
{
- Ecore_Fd_Handler_Flags flags = _handler_flags_get(pd);
-
- if (pd->file)
- pd->handler_fd = _ecore_main_fd_handler_add
- (pd->loop, pd->loop_data, obj, pd->fd, flags,
- _cb_handler_fd, obj, buffer_func, buffer_data,
- EINA_TRUE);
- else
- pd->handler_fd = _ecore_main_fd_handler_add
- (pd->loop, pd->loop_data, obj, pd->fd, flags,
- _cb_handler_fd, obj, buffer_func, buffer_data,
- EINA_FALSE);
+ pd->handler_fd = _ecore_main_fd_handler_add
+ (pd->loop, pd->loop_data, obj, pd->fd, _handler_flags_get(pd),
+ _cb_handler_fd, obj, buffer_func, buffer_data,
+ pd->file ? EINA_TRUE : EINA_FALSE);
if (pd->handler_fd) _handler_active_update(obj, pd);
}
}