BLE: Pal event queue pop before execution.

A race condition was present if a single event was present in the event queue and the event was generating a new event.
pull/13759/head
Vincent Coubard 2020-09-04 17:45:34 +01:00
parent 237278be24
commit 23f7a187fb
1 changed files with 7 additions and 5 deletions

View File

@ -116,11 +116,13 @@ public:
void process()
{
while (_events) {
EventNode *next = _events->next;
_events->event();
_events->~EventNode();
WsfBufFree(_events);
_events = next;
// pop
auto *event = _events;
_events = event->next;
// execute and delete
event->event();
event->~EventNode();
WsfBufFree(event);
}
}