Fix handling of event listener removals during an event callback
We should not modify event_listeners while we are iterating through it. Otherwise, we may crash. If an event listener is removed from within an event callback, then defer the removal until the callback has ended.
Showing with 29 additions and 2 deletions