Issue was that dispatchEvent might call removeWindowEvents/ removeTypeEvents which will delete the event before we can do so. To address this, handled events are now put in a separate list. Reported by psy-fi and reviewed by brecht in IRC.