forked from enlightenment/efl
ecore: handle recursive trigger of promise by the cancel of a future.
This avoid double free/double callback call.
This commit is contained in:
parent
69e330e781
commit
efda7d492d
|
@ -139,11 +139,16 @@ static void
|
||||||
_efl_loop_future_propagate(Eo *obj, Efl_Loop_Future_Data *pd)
|
_efl_loop_future_propagate(Eo *obj, Efl_Loop_Future_Data *pd)
|
||||||
{
|
{
|
||||||
Efl_Event ev;
|
Efl_Event ev;
|
||||||
|
Eina_Bool cancel;
|
||||||
|
|
||||||
ev.object = obj;
|
ev.object = obj;
|
||||||
|
cancel = pd->fulfilled && !pd->message;
|
||||||
|
|
||||||
if (pd->fulfilled &&
|
// This has to be done early on to avoid recursive success/failure to
|
||||||
!pd->message)
|
// bypass the fulfilled check.
|
||||||
|
pd->fulfilled = EINA_TRUE;
|
||||||
|
|
||||||
|
if (cancel)
|
||||||
{
|
{
|
||||||
_efl_loop_future_failure(&ev, pd, EINA_ERROR_FUTURE_CANCEL);
|
_efl_loop_future_failure(&ev, pd, EINA_ERROR_FUTURE_CANCEL);
|
||||||
}
|
}
|
||||||
|
@ -155,7 +160,6 @@ _efl_loop_future_propagate(Eo *obj, Efl_Loop_Future_Data *pd)
|
||||||
{
|
{
|
||||||
_efl_loop_future_failure(&ev, pd, pd->message->error);
|
_efl_loop_future_failure(&ev, pd, pd->message->error);
|
||||||
}
|
}
|
||||||
pd->fulfilled = EINA_TRUE;
|
|
||||||
|
|
||||||
if (!pd->delayed)
|
if (!pd->delayed)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue