From bcf540ff4b441bb0d982600e887c5546787d8abc Mon Sep 17 00:00:00 2001 From: Stefan Sayer Date: Wed, 27 May 2009 14:07:33 +0000 Subject: [PATCH] make it possible for event queues to remove themselves during event broadcast (e.g. shutdown) git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@1416 8eb893ce-cfd4-0310-b710-fb5ebe64c474 --- core/AmEventDispatcher.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/AmEventDispatcher.cpp b/core/AmEventDispatcher.cpp index 8f1b4c8f..65962c89 100644 --- a/core/AmEventDispatcher.cpp +++ b/core/AmEventDispatcher.cpp @@ -136,9 +136,12 @@ bool AmEventDispatcher::broadcast(AmEvent* ev) bool posted = false; m_queues.lock(); - for (EvQueueMapIter it = queues.begin(); - it != queues.end(); it++) { + EvQueueMapIter it = queues.begin(); + while (it != queues.end()) { + it++; + m_queues.unlock(); it->second->postEvent(ev->clone()); + m_queues.lock(); posted = true; }