From: Manuel Nickschas Date: Wed, 6 Oct 2010 07:28:59 +0000 (+0200) Subject: Fix an issue with the event loop X-Git-Tag: 0.8-beta1~99 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=cb35c0c6d9a2c0db1ff380c5fea82fd9406d7333 Fix an issue with the event loop --- diff --git a/src/common/eventmanager.cpp b/src/common/eventmanager.cpp index 36682b06..7303ea5a 100644 --- a/src/common/eventmanager.cpp +++ b/src/common/eventmanager.cpp @@ -218,19 +218,20 @@ void EventManager::dispatchEvent(Event *event) { } // now dispatch the event - QList::const_iterator it = handlers.begin(); - while(it != handlers.end() && !event->isStopped()) { + QList::const_iterator it; + for(it = handlers.begin(); it != handlers.end() && !event->isStopped(); ++it) { QObject *obj = it->object; if(ignored.contains(obj)) // we only deliver an event once to any given object continue; + ignored.insert(obj); + if(filters.contains(obj)) { // we have a filter, so let's check if we want to deliver the event Handler filter = filters.value(obj); bool result = false; void *param[] = {Q_RETURN_ARG(bool, result).data(), Q_ARG(Event *, event).data() }; obj->qt_metacall(QMetaObject::InvokeMetaMethod, filter.methodIndex, param); - ignored.insert(obj); // don't try to deliver the event again either way if(!result) continue; // mmmh, event filter told us to not accept } @@ -238,8 +239,6 @@ void EventManager::dispatchEvent(Event *event) { // finally, deliverance! void *param[] = {0, Q_ARG(Event *, event).data() }; obj->qt_metacall(QMetaObject::InvokeMetaMethod, it->methodIndex, param); - - ++it; } // that's it