summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-12-18 19:04:56 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-12-18 19:54:31 +0900
commit147ef4f91deb99d44c67cbb37fa737d42d8a1792 (patch)
tree2f3e045a43ade34999b4884a24ec0106a3d69163 /src/lib
parent06fea06c867aee5c5d5d79d9e1302e262054b5bb (diff)
ecore: Avoid access to invalid eo id
Not a fan of the solution, as I think some of the logic handling those futures is a bit broken. I'm not 100% sure about this patch. But this improves make check with CK_FORK=no in elm_suite.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/ecore/ecore_events.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/lib/ecore/ecore_events.c b/src/lib/ecore/ecore_events.c
index 49cacd1f07..3adbe042ea 100644
--- a/src/lib/ecore/ecore_events.c
+++ b/src/lib/ecore/ecore_events.c
@@ -71,10 +71,22 @@ ecore_event_add(int type,
71 return (Ecore_Event *)msg; 71 return (Ecore_Event *)msg;
72} 72}
73 73
74static void
75_event_del_cb(void *data, const Efl_Event *ev)
76{
77 Ecore_Future_Schedule_Entry *entry = data;
78 if ((ev->object == (Eo *) entry->event) && entry->future)
79 {
80 eina_future_cancel(entry->future);
81 eina_value_flush(&entry->value);
82 }
83}
84
74EAPI void * 85EAPI void *
75ecore_event_del(Ecore_Event *event) 86ecore_event_del(Ecore_Event *event)
76{ 87{
77 void *data = NULL; 88 void *data = NULL;
89 if (!event) return data;
78 ecore_event_message_data_get((Eo *)event, NULL, &data, NULL, NULL); 90 ecore_event_message_data_get((Eo *)event, NULL, &data, NULL, NULL);
79 _efl_loop_message_unsend((Eo *)event); 91 _efl_loop_message_unsend((Eo *)event);
80 return data; 92 return data;
@@ -141,8 +153,9 @@ ecore_future_free(void *user_data, void *func_data EINA_UNUSED)
141static Eina_Future_Schedule_Entry * 153static Eina_Future_Schedule_Entry *
142ecore_future_schedule(Eina_Future_Scheduler *sched, Eina_Future_Scheduler_Cb cb, Eina_Future *future, Eina_Value value) 154ecore_future_schedule(Eina_Future_Scheduler *sched, Eina_Future_Scheduler_Cb cb, Eina_Future *future, Eina_Value value)
143{ 155{
144 Ecore_Future_Schedule_Entry *entry = eina_mempool_malloc(mp_future_schedule_entry, 156 Ecore_Future_Schedule_Entry *entry;
145 sizeof(Ecore_Future_Schedule_Entry)); 157
158 entry = eina_mempool_malloc(mp_future_schedule_entry, sizeof(*entry));
146 EINA_SAFETY_ON_NULL_RETURN_VAL(entry, NULL); 159 EINA_SAFETY_ON_NULL_RETURN_VAL(entry, NULL);
147 entry->base.scheduler = sched; 160 entry->base.scheduler = sched;
148 entry->cb = cb; 161 entry->cb = cb;
@@ -150,6 +163,7 @@ ecore_future_schedule(Eina_Future_Scheduler *sched, Eina_Future_Scheduler_Cb cb,
150 entry->value = value; 163 entry->value = value;
151 entry->event = ecore_event_add(ECORE_EV_FUTURE_ID, entry, ecore_future_free, entry); 164 entry->event = ecore_event_add(ECORE_EV_FUTURE_ID, entry, ecore_future_free, entry);
152 EINA_SAFETY_ON_NULL_GOTO(entry->event, err); 165 EINA_SAFETY_ON_NULL_GOTO(entry->event, err);
166 efl_event_callback_add((Eo *) entry->event, EFL_EVENT_DEL, _event_del_cb, entry);
153 return &entry->base; 167 return &entry->base;
154 168
155 err: 169 err: