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>
This commit is contained in:
Morten Sørvig 2022-12-29 20:30:03 +01:00 committed by Morten Johan Sørvig
parent 16d0e59ea0
commit daba0b8c19
4 changed files with 3 additions and 13 deletions

View File

@ -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);

View File

@ -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:

View File

@ -14,8 +14,4 @@ void QWasmEventDispatcher::processWindowSystemEvents(QEventLoop::ProcessEventsFl
QWindowSystemInterface::sendWindowSystemEvents(flags);
}
bool QWasmEventDispatcher::hasWindowSystemEvents() {
return QWindowSystemInterface::windowSystemEventsQueued();
}
QT_END_NAMESPACE

View File

@ -12,7 +12,6 @@ class QWasmEventDispatcher : public QEventDispatcherWasm
{
protected:
void processWindowSystemEvents(QEventLoop::ProcessEventsFlags flags) override;
bool hasWindowSystemEvents() override;
};
QT_END_NAMESPACE