summaryrefslogtreecommitdiff
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
parent46fbbef13a0cc7d5612720f96ff23e0bb1d52cc5 (diff)
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)
1040 } 1040 }
1041#endif 1041#endif
1042 } 1042 }
1043# ifdef HAVE_EPOLL
1043 if (pd->epoll_fd >= 0) 1044 if (pd->epoll_fd >= 0)
1044 { 1045 {
1045 close(pd->epoll_fd); 1046 close(pd->epoll_fd);
1046 pd->epoll_fd = -1; 1047 pd->epoll_fd = -1;
1047 } 1048 }
1049#endif
1048 if (pd->timer_fd >= 0) 1050 if (pd->timer_fd >= 0)
1049 { 1051 {
1050 close(pd->timer_fd); 1052 close(pd->timer_fd);
@@ -1320,7 +1322,6 @@ _ecore_main_fd_handler_add(Eo *obj,
1320 pd->fd_handlers = (Ecore_Fd_Handler *) 1322 pd->fd_handlers = (Ecore_Fd_Handler *)
1321 eina_inlist_append(EINA_INLIST_GET(pd->fd_handlers), 1323 eina_inlist_append(EINA_INLIST_GET(pd->fd_handlers),
1322 EINA_INLIST_GET(fdh)); 1324 EINA_INLIST_GET(fdh));
1323
1324 return fdh; 1325 return fdh;
1325} 1326}
1326 1327
@@ -1606,27 +1607,26 @@ _ecore_main_content_clear(Efl_Loop_Data *pd)
1606 if (fdh->handler) efl_del(fdh->handler); 1607 if (fdh->handler) efl_del(fdh->handler);
1607 else 1608 else
1608 { 1609 {
1609 ECORE_MAGIC_SET(fdh, ECORE_MAGIC_NONE); 1610// XXX: can't do this because this fd handler is legacy and might
1610 ecore_fd_handler_mp_free(fdh); 1611// be cleaned up later in object destructors
1612// ECORE_MAGIC_SET(fdh, ECORE_MAGIC_NONE);
1613// ecore_fd_handler_mp_free(fdh);
1611 } 1614 }
1612 } 1615 }
1613 if (pd) 1616 if (pd->fd_handlers_with_buffer)
1614 { 1617 pd->fd_handlers_with_buffer =
1615 if (pd->fd_handlers_with_buffer) 1618 eina_list_free(pd->fd_handlers_with_buffer);
1616 pd->fd_handlers_with_buffer = 1619 if (pd->fd_handlers_with_prep)
1617 eina_list_free(pd->fd_handlers_with_buffer); 1620 pd->fd_handlers_with_prep =
1618 if (pd->fd_handlers_with_prep) 1621 eina_list_free(pd->fd_handlers_with_prep);
1619 pd->fd_handlers_with_prep = 1622 if (pd->file_fd_handlers)
1620 eina_list_free(pd->fd_handlers_with_prep); 1623 pd->file_fd_handlers =
1621 if (pd->file_fd_handlers) 1624 eina_list_free(pd->file_fd_handlers);
1622 pd->file_fd_handlers = 1625 if (pd->fd_handlers_to_delete)
1623 eina_list_free(pd->file_fd_handlers); 1626 pd->fd_handlers_to_delete =
1624 if (pd->fd_handlers_to_delete) 1627 eina_list_free(pd->fd_handlers_to_delete);
1625 pd->fd_handlers_to_delete = 1628 pd->fd_handlers_to_call = NULL;
1626 eina_list_free(pd->fd_handlers_to_delete); 1629 pd->fd_handlers_to_call_current = NULL;
1627 pd->fd_handlers_to_call = NULL;
1628 pd->fd_handlers_to_call_current = NULL;
1629 }
1630 1630
1631 pd->do_quit = 0; 1631 pd->do_quit = 0;
1632 1632
@@ -1662,7 +1662,6 @@ _ecore_main_shutdown(void)
1662 ERR("Calling ecore_shutdown() while still in the main loop!!!"); 1662 ERR("Calling ecore_shutdown() while still in the main loop!!!");
1663 return; 1663 return;
1664 } 1664 }
1665 _ecore_main_content_clear(pd);
1666} 1665}
1667 1666
1668static void 1667static 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)
53 Efl_Loop_Data *loop = pd->loop_data; 53 Efl_Loop_Data *loop = pd->loop_data;
54 54
55 if (pd->handler_fd) 55 if (pd->handler_fd)
56 _ecore_main_fd_handler_del(obj, loop, pd->handler_fd); 56 {
57 _ecore_main_fd_handler_del(obj, loop, pd->handler_fd);
58 pd->handler_fd = NULL;
59 }
57 else if (pd->handler_win32) 60 else if (pd->handler_win32)
58 _ecore_main_win32_handler_del(obj, loop, pd->handler_win32); 61 {
59 pd->handler_fd = NULL; 62 _ecore_main_win32_handler_del(obj, loop, pd->handler_win32);
60 pd->handler_win32 = NULL; 63 pd->handler_win32 = NULL;
64 }
61} 65}
62 66
63static Ecore_Fd_Handler_Flags 67static Ecore_Fd_Handler_Flags
@@ -108,18 +112,10 @@ _handler_reset(Eo *obj, Efl_Loop_Handler_Data *pd)
108 _handler_active_update(obj, pd); 112 _handler_active_update(obj, pd);
109 else 113 else
110 { 114 {
111 Ecore_Fd_Handler_Flags flags = _handler_flags_get(pd); 115 pd->handler_fd = _ecore_main_fd_handler_add
112 116 (pd->loop, pd->loop_data, obj, pd->fd, _handler_flags_get(pd),
113 if (pd->file) 117 _cb_handler_fd, obj, buffer_func, buffer_data,
114 pd->handler_fd = _ecore_main_fd_handler_add 118 pd->file ? EINA_TRUE : EINA_FALSE);
115 (pd->loop, pd->loop_data, obj, pd->fd, flags,
116 _cb_handler_fd, obj, buffer_func, buffer_data,
117 EINA_TRUE);
118 else
119 pd->handler_fd = _ecore_main_fd_handler_add
120 (pd->loop, pd->loop_data, obj, pd->fd, flags,
121 _cb_handler_fd, obj, buffer_func, buffer_data,
122 EINA_FALSE);
123 if (pd->handler_fd) _handler_active_update(obj, pd); 119 if (pd->handler_fd) _handler_active_update(obj, pd);
124 } 120 }
125 } 121 }