Fix fake event queue process event.

The result of remove_if was fed into erase without checking something
was actually removed.
pull/14254/head
Vincent Coubard 2021-02-09 17:45:24 +00:00
parent 0feaae6d18
commit a3a507d9ca
1 changed files with 14 additions and 13 deletions

View File

@ -98,8 +98,7 @@ void EventQueue::process_events() {
} }
/* dispatch all handlers that happen at this time */ /* dispatch all handlers that happen at this time */
_handlers.erase( auto found = std::remove_if(
std::remove_if(
_handlers.begin(), _handlers.begin(),
_handlers.end(), _handlers.end(),
[earliest_tick](internal_event& element) -> bool { [earliest_tick](internal_event& element) -> bool {
@ -110,9 +109,11 @@ void EventQueue::process_events() {
return false; return false;
} }
} }
),
_handlers.end()
); );
if (found != _handlers.end()) {
_handlers.erase(found, _handlers.end());
}
} }
} }