Asserting we're not freeing active event #1642
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #1638.
Although, could be done differently if you have suggestions.
Conditions:
evcb_flags & EVLIST_INIT
to setev
! (ev->ev_events & EV_PERSIST)
to skipevent_queue_remove_active
! (ev->ev_flags & EVLIST_FINALIZING)
to skipevent_queue_remove_active
ev->ev_base == NULL
to skipevent_queue_remove_active
inevent_del_nolock_
! (ev->ev_flags & EVLIST_ACTIVE)
to skipevent_queue_remove_active
inevent_del_nolock_
evcb->evcb_closure == EV_CLOSURE_EVENT_FINALIZE_FREE
for the free to occur! base->event_break
to continue the loop! base->event_continue
to continue the loopWhen those conditions are met, we free an event without removing it from the queue.
If you know that one of those conditions is strictly impossible, then we could add a specific assert instead my current proposal.
Another alternative to "not free" when it's in the queue, is to remove that event from the queue when above conditions arise, but I wouldn't know the side effects of such change.