efl_canvas_object_animation: fix possible invalid pointer

now if one of the event handlers calls animation_stop in a callback to
EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_PROGRESS_UPDATED, then
pd->in will be freeed. Which means, in the next event handler the
address taken by &pd->in->progress might be invalid, leading to a crash.

With this commit this is a address on the stack, which should fix this.
This commit is contained in:
Marcel Hollerbach 2019-11-21 18:41:08 +01:00
parent eeff991076
commit 17ba8515f1
1 changed files with 2 additions and 1 deletions

View File

@ -59,7 +59,8 @@ _animator_cb(void *data, const Efl_Event *ev EINA_UNUSED)
efl_gfx_mapping_reset(obj);
efl_animation_apply(pd->in->animation, pd->in->progress, obj);
efl_event_callback_call(obj, EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_PROGRESS_UPDATED, &pd->in->progress);
double progress = pd->in->progress;
efl_event_callback_call(obj, EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_PROGRESS_UPDATED, &progress);
//Check if animation stopped in animation_progress,updated callback.
if (!pd->in) return;