From 1eeaeca2c6618341763b923a30fd19cead354178 Mon Sep 17 00:00:00 2001 From: Joe Finney Date: Wed, 28 Oct 2015 14:17:12 +0000 Subject: [PATCH] microbit: BUGFIX - correct initialization of MicroBitListener code now correctly initiailizes the evt_queue filed needed to prevent lockup during event processing (understandably!). --- source/MicroBitListener.cpp | 2 ++ source/MicroBitMessageBus.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/source/MicroBitListener.cpp b/source/MicroBitListener.cpp index 09f1498..d04c320 100644 --- a/source/MicroBitListener.cpp +++ b/source/MicroBitListener.cpp @@ -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; } /** diff --git a/source/MicroBitMessageBus.cpp b/source/MicroBitMessageBus.cpp index 12d9a34..1cfba19 100644 --- a/source/MicroBitMessageBus.cpp +++ b/source/MicroBitMessageBus.cpp @@ -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;