diff options
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_symbian.cpp | 19 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_symbian_p.h | 4 |
2 files changed, 18 insertions, 5 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index e1e3e0e..aca328a 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -98,7 +98,8 @@ inline QActiveObject::QActiveObject(TInt priority, QEventDispatcherSymbian *disp : CActive(priority), m_dispatcher(dispatcher), m_hasAlreadyRun(false), - m_hasRunAgain(false) + m_hasRunAgain(false), + m_iterationCount(1) { } @@ -112,13 +113,16 @@ bool QActiveObject::okToRun() { Q_ASSERT(!m_hasRunAgain); - if (m_hasAlreadyRun) { + if (!m_hasAlreadyRun || m_dispatcher->iterationCount() != m_iterationCount) { + // First occurrence of this event in this iteration. + m_hasAlreadyRun = true; + m_iterationCount = m_dispatcher->iterationCount(); + return true; + } else { + // The event has already occurred. m_dispatcher->addDeferredActiveObject(this); m_hasRunAgain = true; return false; - } else { - m_hasAlreadyRun = true; - return true; } } @@ -528,6 +532,7 @@ QEventDispatcherSymbian::QEventDispatcherSymbian(QObject *parent) m_completeDeferredAOs(0), m_interrupt(false), m_wakeUpDone(0), + m_iterationCount(0), m_noSocketEvents(false) { } @@ -566,6 +571,10 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla { Q_D(QAbstractEventDispatcher); + // It is safe if this counter overflows. The main importance is that each + // iteration count is different from the last. + m_iterationCount++; + RThread &thread = d->threadData->symbian_thread_handle; bool block; diff --git a/src/corelib/kernel/qeventdispatcher_symbian_p.h b/src/corelib/kernel/qeventdispatcher_symbian_p.h index 3233fe4..393749f 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian_p.h +++ b/src/corelib/kernel/qeventdispatcher_symbian_p.h @@ -61,6 +61,7 @@ protected: private: bool m_hasAlreadyRun : 1; bool m_hasRunAgain : 1; + int m_iterationCount; }; class QWakeUpActiveObject : public CActive @@ -207,6 +208,8 @@ public: void removeDeferredActiveObject(QActiveObject *object); void reactivateDeferredActiveObjects(); + inline int iterationCount() const { return m_iterationCount; } + static void RequestComplete(TRequestStatus *&status, TInt reason); static void RequestComplete(RThread &threadHandle, TRequestStatus *&status, TInt reason); @@ -228,6 +231,7 @@ private: volatile bool m_interrupt; QAtomicInt m_wakeUpDone; + unsigned char m_iterationCount; bool m_noSocketEvents; QList<QSocketActiveObject *> m_deferredSocketEvents; |