Hi Cedric,

Tried this fix for efl_net_server_example and it doesn't fix the
problem, instead it stops crashes but enters an infinite loop:

ERR<17134>:ecore lib/ecore/efl_promise.c:301 _efl_loop_future_cancel()
Triggering cancel on an already fulfilled Efl.Future.

since it's now expected that the promise will NULL-ify the pointer
once its done, this must be done earlier as well, otherwise my pd->job
(efl_io_copier.c) will still use that in its destructor.



On Tue, Oct 18, 2016 at 9:49 PM, Cedric BAIL <cedric.b...@free.fr> wrote:
> cedric pushed a commit to branch master.
>
> http://git.enlightenment.org/core/efl.git/commit/?id=efda7d492d55b2117bdc29d5c03f03fc1a32db3a
>
> commit efda7d492d55b2117bdc29d5c03f03fc1a32db3a
> Author: Cedric BAIL <ced...@osg.samsung.com>
> Date:   Tue Oct 18 16:49:04 2016 -0700
>
>     ecore: handle recursive trigger of promise by the cancel of a future.
>
>     This avoid double free/double callback call.
> ---
>  src/lib/ecore/efl_promise.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/src/lib/ecore/efl_promise.c b/src/lib/ecore/efl_promise.c
> index 4bc7496..aa59b8b 100644
> --- a/src/lib/ecore/efl_promise.c
> +++ b/src/lib/ecore/efl_promise.c
> @@ -139,11 +139,16 @@ static void
>  _efl_loop_future_propagate(Eo *obj, Efl_Loop_Future_Data *pd)
>  {
>     Efl_Event ev;
> +   Eina_Bool cancel;
>
>     ev.object = obj;
> +   cancel = pd->fulfilled && !pd->message;
>
> -   if (pd->fulfilled &&
> -       !pd->message)
> +   // This has to be done early on to avoid recursive success/failure to
> +   // bypass the fulfilled check.
> +   pd->fulfilled = EINA_TRUE;
> +
> +   if (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);
>       }
> -   pd->fulfilled = EINA_TRUE;
>
>     if (!pd->delayed)
>       {
>
> --
>
>



-- 
Gustavo Sverzut Barbieri
--------------------------------------
Mobile: +55 (16) 99354-9890

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to