summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2020-08-10 10:43:18 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-08-12 11:18:10 +0200
commit812e9f9f09e4789284536ea7fc10634e0c1148b7 (patch)
treeb6669828b944df8b40ffb2762ab38b98ce18a810
parenta923cb0f7b236f65496e4393b35082194b35d193 (diff)
eo: set idx on exit to 1 not to 0
if this is set to 0 the next iteration in the upper frame event would decrement the 0 again leading to a overflow making the iteration and callback array overflow. Long story short: set ifx to 1 to prevent overflow, test added. fixes T8787 Differential Revision: https://phab.enlightenment.org/D12101
-rw-r--r--src/lib/eo/eo_base_class.c4
-rw-r--r--src/tests/eo/signals/signals_main.c31
2 files changed, 33 insertions, 2 deletions
diff --git a/src/lib/eo/eo_base_class.c b/src/lib/eo/eo_base_class.c
index bd394910c9..e7445021bd 100644
--- a/src/lib/eo/eo_base_class.c
+++ b/src/lib/eo/eo_base_class.c
@@ -2146,7 +2146,9 @@ restart_back:
2146 2146
2147end: 2147end:
2148 // Handling restarting list walking complete exit. 2148 // Handling restarting list walking complete exit.
2149 if (restart_lookup) restart_lookup->idx = 0; 2149 // This must be 1, we copy back the frame idx at the end of the for loop.
2150 // The next iteration then decrements the idx by 1 which results in the effective running idx of that frame beeing 0
2151 if (restart_lookup) restart_lookup->idx = 1;
2150 2152
2151 EVENT_STACK_POP(pd); 2153 EVENT_STACK_POP(pd);
2152 2154
diff --git a/src/tests/eo/signals/signals_main.c b/src/tests/eo/signals/signals_main.c
index c3b1648c17..859e145ecb 100644
--- a/src/tests/eo/signals/signals_main.c
+++ b/src/tests/eo/signals/signals_main.c
@@ -74,6 +74,22 @@ _restart_3_cb(void *data, const Efl_Event *event)
74 called++; 74 called++;
75} 75}
76 76
77static void
78_restart_3_no_stop_cb(void *data, const Efl_Event *event)
79{
80 fprintf(stderr, "restart 3 no stop inside: %i\n", inside);
81 fprintf(stderr, "restart 3 no stop exit inside: %i (%i)\n", inside, called);
82
83 if (!inside)
84 {
85 inside = EINA_TRUE;
86 efl_event_callback_call(event->object, event->desc, data);
87 inside = EINA_FALSE;
88 }
89
90 called++;
91}
92
77int 93int
78main(int argc, char *argv[]) 94main(int argc, char *argv[])
79{ 95{
@@ -219,8 +235,21 @@ main(int argc, char *argv[])
219 efl_event_callback_legacy_call(obj, EV_RESTART, NULL); 235 efl_event_callback_legacy_call(obj, EV_RESTART, NULL);
220 fail_if(inside); 236 fail_if(inside);
221 fail_if(called != 3); 237 fail_if(called != 3);
222
223 efl_unref(obj); 238 efl_unref(obj);
239
240 pd = NULL;
241 inside = EINA_FALSE;
242 called = 0;
243
244 obj = efl_add_ref(SIMPLE_CLASS, NULL);
245 efl_event_callback_add(obj, EV_RESTART, _restart_3_no_stop_cb, NULL);
246 efl_event_callback_add(obj, EV_RESTART, _null_cb, NULL);
247 efl_event_callback_add(obj, EV_RESTART, _restart_3_no_stop_cb, NULL);
248 efl_event_callback_call(obj, EV_RESTART, NULL);
249 fail_if(inside);
250 fail_if(called != 2);
251
252
224 efl_object_shutdown(); 253 efl_object_shutdown();
225 return 0; 254 return 0;
226} 255}