summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric Bail <cedric@osg.samsung.com>2017-11-23 15:12:30 -0800
committerCedric Bail <cedric@osg.samsung.com>2017-11-23 15:12:30 -0800
commita1ea022cf666698edd1ff5405c817373496fbb1d (patch)
tree83e0296e7890c41f350bfaf54429913b5860dc0f
parentb798005e809e6fcd3fc807e57042861d1019b71d (diff)
downloadefl-a1ea022cf666698edd1ff5405c817373496fbb1d.tar.gz
ecore: during fd cleanup we didn't remove freed fd handler from the ready fd list.
-rw-r--r--src/lib/ecore/ecore_main.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/src/lib/ecore/ecore_main.c b/src/lib/ecore/ecore_main.c
index f85d2cdc0d..c5544e4fe7 100644
--- a/src/lib/ecore/ecore_main.c
+++ b/src/lib/ecore/ecore_main.c
@@ -1931,10 +1931,33 @@ _ecore_main_fd_handlers_bads_rem(void)
static void
_ecore_main_fd_handlers_cleanup(void)
{
- Ecore_Fd_Handler *fdh;
+ Ecore_Fd_Handler *fdh, *last;
Eina_List *l, *l2;
if (!fd_handlers_to_delete) return;
+
+ // Cleanup deleted caller from the list
+ last = NULL;
+ fdh = fd_handlers_to_call;
+ while (fdh)
+ {
+ if (fdh->delete_me)
+ {
+ if (!last)
+ fd_handlers_to_call = fdh == fdh->next_ready ? NULL : fdh->next_ready;
+ else
+ last->next_ready = fdh == fdh->next_ready ? last : fdh->next_ready;
+ }
+ else
+ {
+ last = fdh;
+ }
+
+ if (fdh == fdh->next_ready)
+ break;
+ fdh = fdh->next_ready;
+ }
+
EINA_LIST_FOREACH_SAFE(fd_handlers_to_delete, l, l2, fdh)
{
if (!fdh)
@@ -1945,6 +1968,8 @@ _ecore_main_fd_handlers_cleanup(void)
/* fdh->delete_me should be set for all fdhs at the start of the list */
if (fdh->references)
continue;
+ if (fd_handlers_to_call_current == fdh)
+ fd_handlers_to_call_current = NULL;
if (fdh->buf_func && fd_handlers_with_buffer)
fd_handlers_with_buffer = eina_list_remove(fd_handlers_with_buffer, fdh);
if (fdh->prep_func && fd_handlers_with_prep)
@@ -1992,7 +2017,7 @@ static void
_ecore_main_fd_handlers_call(void)
{
/* grab a new list */
- if (!fd_handlers_to_call_current)
+ if (!fd_handlers_to_call_current)
{
fd_handlers_to_call_current = fd_handlers_to_call;
fd_handlers_to_call = NULL;