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() void process()
{ {
while (_events) { while (_events) {
EventNode *next = _events->next; // pop
_events->event(); auto *event = _events;
_events->~EventNode(); _events = event->next;
WsfBufFree(_events); // execute and delete
_events = next; event->event();
event->~EventNode();
WsfBufFree(event);
} }
} }