mirror of https://github.com/ARMmbed/mbed-os.git
Fix fake event queue process event.
The result of remove_if was fed into erase without checking something was actually removed.pull/14254/head
parent
0feaae6d18
commit
a3a507d9ca
|
@ -98,21 +98,22 @@ 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 {
|
if (earliest_tick >= element.tick) {
|
||||||
if (earliest_tick >= element.tick) {
|
(*(element.handler))();
|
||||||
(*(element.handler))();
|
return true;
|
||||||
return true;
|
} else {
|
||||||
} else {
|
return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
),
|
}
|
||||||
_handlers.end()
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (found != _handlers.end()) {
|
||||||
|
_handlers.erase(found, _handlers.end());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue