diff options
author | Morten Sørvig <morten.sorvig@qt.io> | 2022-12-29 20:30:03 +0100 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@qt.io> | 2023-01-06 16:42:45 +0000 |
commit | daba0b8c19284fb68493cb8350804277b94b79ba (patch) | |
tree | 680927dfb0eaa0376a24cf6b1c08f01b77de1bee | |
parent | 16d0e59ea06b22b72659d1472dd238665ba85916 (diff) |
wasm: Fix secondary thread event processing
Fix test failure in WasmEventDispatcherTest::postEventSecondaryThread()
Revert to using qGlobalPostedEventsCount() for determining
pending events state, but move the final check to after
sending posted events. Also remove a superfluous check.
This partially reverts/amends cc60d706.
Task-number: QTBUG-109066
Pick-to: 6.5
Change-Id: If4f437ce9379282c3d60b0272845a975794883de
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_wasm.cpp | 10 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_wasm_p.h | 1 | ||||
-rw-r--r-- | src/plugins/platforms/wasm/qwasmeventdispatcher.cpp | 4 | ||||
-rw-r--r-- | src/plugins/platforms/wasm/qwasmeventdispatcher.h | 1 |
4 files changed, 3 insertions, 13 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_wasm.cpp b/src/corelib/kernel/qeventdispatcher_wasm.cpp index 23d558a61b..cc79324096 100644 --- a/src/corelib/kernel/qeventdispatcher_wasm.cpp +++ b/src/corelib/kernel/qeventdispatcher_wasm.cpp @@ -209,7 +209,7 @@ bool QEventDispatcherWasm::processEvents(QEventLoop::ProcessEventsFlags flags) { emit awake(); - bool hasPendingEvents = hasWindowSystemEvents(); + bool hasPendingEvents = qGlobalPostedEventsCount() > 0; qCDebug(lcEventDispatcher) << "QEventDispatcherWasm::processEvents flags" << flags << "pending events" << hasPendingEvents; @@ -234,10 +234,10 @@ bool QEventDispatcherWasm::processEvents(QEventLoop::ProcessEventsFlags flags) processTimers(); } - hasPendingEvents = hasWindowSystemEvents(); QCoreApplication::sendPostedEvents(); processWindowSystemEvents(flags); - return hasPendingEvents; + + return qGlobalPostedEventsCount() > 0; } void QEventDispatcherWasm::processWindowSystemEvents(QEventLoop::ProcessEventsFlags flags) @@ -245,10 +245,6 @@ void QEventDispatcherWasm::processWindowSystemEvents(QEventLoop::ProcessEventsFl Q_UNUSED(flags); } -bool QEventDispatcherWasm::hasWindowSystemEvents() { - return false; -} - void QEventDispatcherWasm::registerSocketNotifier(QSocketNotifier *notifier) { LOCK_GUARD(g_staticDataMutex); diff --git a/src/corelib/kernel/qeventdispatcher_wasm_p.h b/src/corelib/kernel/qeventdispatcher_wasm_p.h index 3c211b3052..50f1bda2b2 100644 --- a/src/corelib/kernel/qeventdispatcher_wasm_p.h +++ b/src/corelib/kernel/qeventdispatcher_wasm_p.h @@ -53,7 +53,6 @@ public: static void socketSelect(int timeout, int socket, bool waitForRead, bool waitForWrite, bool *selectForRead, bool *selectForWrite, bool *socketDisconnect); protected: - virtual bool hasWindowSystemEvents(); virtual void processWindowSystemEvents(QEventLoop::ProcessEventsFlags flags); private: diff --git a/src/plugins/platforms/wasm/qwasmeventdispatcher.cpp b/src/plugins/platforms/wasm/qwasmeventdispatcher.cpp index f48bcb6314..2fd1a30401 100644 --- a/src/plugins/platforms/wasm/qwasmeventdispatcher.cpp +++ b/src/plugins/platforms/wasm/qwasmeventdispatcher.cpp @@ -14,8 +14,4 @@ void QWasmEventDispatcher::processWindowSystemEvents(QEventLoop::ProcessEventsFl QWindowSystemInterface::sendWindowSystemEvents(flags); } -bool QWasmEventDispatcher::hasWindowSystemEvents() { - return QWindowSystemInterface::windowSystemEventsQueued(); -} - QT_END_NAMESPACE diff --git a/src/plugins/platforms/wasm/qwasmeventdispatcher.h b/src/plugins/platforms/wasm/qwasmeventdispatcher.h index 5b9b08cba3..a28fa7263b 100644 --- a/src/plugins/platforms/wasm/qwasmeventdispatcher.h +++ b/src/plugins/platforms/wasm/qwasmeventdispatcher.h @@ -12,7 +12,6 @@ class QWasmEventDispatcher : public QEventDispatcherWasm { protected: void processWindowSystemEvents(QEventLoop::ProcessEventsFlags flags) override; - bool hasWindowSystemEvents() override; }; QT_END_NAMESPACE |