microbit: BUGFIX - correct initialization of MicroBitListener

code now correctly initiailizes the evt_queue filed needed to prevent
lockup during event processing (understandably!).
This commit is contained in:
Joe Finney 2015-10-28 14:17:12 +00:00
parent 72e5a9a6a6
commit 1eeaeca2c6
2 changed files with 3 additions and 1 deletions

View file

@ -23,6 +23,7 @@ MicroBitListener::MicroBitListener(uint16_t id, uint16_t value, void (*handler)(
this->cb_arg = NULL;
this->flags = flags;
this->next = NULL;
this->evt_queue = NULL;
}
/**
@ -41,6 +42,7 @@ MicroBitListener::MicroBitListener(uint16_t id, uint16_t value, void (*handler)(
this->cb_arg = arg;
this->flags = flags | MESSAGE_BUS_LISTENER_PARAMETERISED;
this->next = NULL;
this->evt_queue = NULL;
}
/**

View file

@ -66,7 +66,7 @@ void async_callback(void *param)
else
listener->cb(listener->evt);
// If there are more events to process, dequeue te next one and process it.
// If there are more events to process, dequeue the next one and process it.
if ((listener->flags & MESSAGE_BUS_LISTENER_QUEUE_IF_BUSY) && listener->evt_queue)
{
MicroBitEventQueueItem *item = listener->evt_queue;