Page MenuHomePhabricator

eina: prevent double cancel of ongoing dispatched future.
ClosedPublic

Authored by cedric on Mar 13 2019, 2:58 PM.

Diff Detail

Repository
rEFL core/efl
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
cedric created this revision.Mar 13 2019, 2:58 PM
cedric updated this revision to Diff 20645.Mar 15 2019, 4:58 PM
cedric added a reviewer: YOhoho.

Rebase.

bu5hm4n requested changes to this revision.Mar 16 2019, 8:03 AM
bu5hm4n added inline comments.
src/lib/eina/eina_promise.c
478

I am not sure here, what if we have a then attached to something which is already dispatched. But in the callback the promise is dispatched again, shouldn't this just jump to the end and execute f = _eina_future_free(f) and continue the loop just like normal ?

This revision now requires changes to proceed.Mar 16 2019, 8:03 AM
cedric added inline comments.Mar 16 2019, 10:29 AM
src/lib/eina/eina_promise.c
478

So future are in a chained list structure. You can have triggered one at the beginning of that chain, but somewhere in the wonderful world of asynchronous mess and callback, someone may have decided to cancel another or the same future. The future that has been already dispatched will proceed and need to proceed with the rest of the chain it has started on already (especially the next one as I really can't find a way to destroy the next future, not the one that is already dispatched, without crashing everything ). This is why I do not free the already dispatched one and also stop destroying the world.

bu5hm4n accepted this revision.Mar 16 2019, 10:49 AM
bu5hm4n added inline comments.
src/lib/eina/eina_promise.c
478

... this is damaging brains ...

This revision is now accepted and ready to land.Mar 16 2019, 10:49 AM
cedric updated this revision to Diff 20807.Mar 20 2019, 11:34 AM

Rebase and correct.

cedric updated this revision to Diff 20994.Mar 27 2019, 2:27 PM

Rebase.

This revision was automatically updated to reflect the committed changes.