Page MenuHomePhabricator

eina: prevent double cancel of ongoing dispatched future.
AcceptedPublic

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

Diff Detail

Repository
rEFL core/efl
Branch
devs/cedric/fileselector
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 10508
cedric created this revision.Wed, Mar 13, 2:58 PM
cedric updated this revision to Diff 20645.Fri, Mar 15, 4:58 PM
cedric added a reviewer: YOhoho.

Rebase.

bu5hm4n requested changes to this revision.Sat, Mar 16, 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.Sat, Mar 16, 8:03 AM
cedric added inline comments.Sat, Mar 16, 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.Sat, Mar 16, 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.Sat, Mar 16, 10:49 AM
cedric updated this revision to Diff 20807.Wed, Mar 20, 11:34 AM

Rebase and correct.