summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas/evas_callbacks.c
diff options
context:
space:
mode:
authorRafael Antognolli <rafael.antognolli@intel.com>2013-06-06 18:35:12 -0300
committerRafael Antognolli <rafael.antognolli@intel.com>2013-06-06 18:42:16 -0300
commit4b5d52fca12b74871f14883566b29ef274eaf860 (patch)
treece6c4a2de5022dc8efe57be686dbd239536f52d9 /src/lib/evas/canvas/evas_callbacks.c
parentf1ba71147e6522d5f5bce48e81bf5f2dab3068d6 (diff)
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.
Diffstat (limited to 'src/lib/evas/canvas/evas_callbacks.c')
-rw-r--r--src/lib/evas/canvas/evas_callbacks.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/evas/canvas/evas_callbacks.c b/src/lib/evas/canvas/evas_callbacks.c
index 4d1c16d511..b85cc39b32 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)
152{ 152{
153 Evas_Post_Callback *pc; 153 Evas_Post_Callback *pc;
154 int skip = 0; 154 int skip = 0;
155 static int first_run = 1; // FIXME: This is a workaround to prevent this
156 // function from being called recursively.
155 157
156 if (e->delete_me) return; 158 if (e->delete_me || (!first_run)) return;
157 _evas_walk(e); 159 _evas_walk(e);
160 first_run = 0;
158 EINA_LIST_FREE(e->post_events, pc) 161 EINA_LIST_FREE(e->post_events, pc)
159 { 162 {
160 if ((!skip) && (!e->delete_me) && (!pc->delete_me)) 163 if ((!skip) && (!e->delete_me) && (!pc->delete_me))
@@ -163,6 +166,7 @@ _evas_post_event_callback_call(Evas *eo_e, Evas_Public_Data *e)
163 } 166 }
164 EVAS_MEMPOOL_FREE(_mp_pc, pc); 167 EVAS_MEMPOOL_FREE(_mp_pc, pc);
165 } 168 }
169 first_run = 1;
166 _evas_unwalk(e); 170 _evas_unwalk(e);
167} 171}
168 172