antognolli pushed a commit to branch master.
commit 4b5d52fca12b74871f14883566b29ef274eaf860
Author: Rafael Antognolli <[email protected]>
Date: Thu Jun 6 18:35:12 2013 -0300
evas/callbacks: Prevent post_event_callback_call recursion.
If this function is called recursively, it will free the list of post
callbacks before the list stops being used, which will cause a segfault.
The only place where this seems to happen is on
https://phab.enlightenment.org/T124, probably due to the extensive mouse
events which are launched in an unexpected way.
This bug started happening after commit
164cc07237395f8fe6efa465e4f0c0c4863f78ed, where the
_elm_scroll_page_x_get() started being called by a post_event callback,
and forcing an edje recalc. This recalc triggered another post_event
callback, thus causing the mentioned segfault.
If there's a better way to prevent this from happening, please change
the mentioned code.
---
src/lib/evas/canvas/evas_callbacks.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/lib/evas/canvas/evas_callbacks.c
b/src/lib/evas/canvas/evas_callbacks.c
index 4d1c16d..b85cc39 100644
--- a/src/lib/evas/canvas/evas_callbacks.c
+++ b/src/lib/evas/canvas/evas_callbacks.c
@@ -152,9 +152,12 @@ _evas_post_event_callback_call(Evas *eo_e,
Evas_Public_Data *e)
{
Evas_Post_Callback *pc;
int skip = 0;
+ static int first_run = 1; // FIXME: This is a workaround to prevent this
+ // function from being called recursively.
- if (e->delete_me) return;
+ if (e->delete_me || (!first_run)) return;
_evas_walk(e);
+ first_run = 0;
EINA_LIST_FREE(e->post_events, pc)
{
if ((!skip) && (!e->delete_me) && (!pc->delete_me))
@@ -163,6 +166,7 @@ _evas_post_event_callback_call(Evas *eo_e, Evas_Public_Data
*e)
}
EVAS_MEMPOOL_FREE(_mp_pc, pc);
}
+ first_run = 1;
_evas_unwalk(e);
}
--
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j