summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qeventdispatcher_wasm.cpp
diff options
context:
space:
mode:
authorMikolaj Boc <mikolaj.boc@qt.io>2023-08-09 15:36:37 +0200
committerMikolaj Boc <mikolaj.boc@qt.io>2023-08-16 16:25:48 +0200
commitd0c92821af188f49c8b53b86f0b0816c2b9886b2 (patch)
tree602ab838c4e6fb0ed974cbe1e9a6e7d36aba1454 /src/corelib/kernel/qeventdispatcher_wasm.cpp
parent3adf81f09f019199d7e5bb008196657c8a76e840 (diff)
Do not call processEvents async with JSPI enabled on WASM
With JSPI, the main dispatcher loop is not exited and processEvents should not be called, as events will get processed after the thread has been unsuspended. processEvents posted with emscripten_async_call causes stack corruption. Fixes: QTBUG-115959 Change-Id: Ibccccbf54f18df2d03f0c5e817c3a7102e96c9ed Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/corelib/kernel/qeventdispatcher_wasm.cpp')
-rw-r--r--src/corelib/kernel/qeventdispatcher_wasm.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_wasm.cpp b/src/corelib/kernel/qeventdispatcher_wasm.cpp
index 00f3f97ee8..ce245a75a1 100644
--- a/src/corelib/kernel/qeventdispatcher_wasm.cpp
+++ b/src/corelib/kernel/qeventdispatcher_wasm.cpp
@@ -420,7 +420,9 @@ void QEventDispatcherWasm::wakeUp()
// event loop. Make sure the thread is unblocked or make it
// process events.
bool wasBlocked = wakeEventDispatcherThread();
- if (!wasBlocked && isMainThreadEventDispatcher()) {
+ // JSPI does not need a scheduled call to processPostedEvents, as the stack is not unwound
+ // at startup.
+ if (!qstdweb::haveJspi() && !wasBlocked && isMainThreadEventDispatcher()) {
{
LOCK_GUARD(m_mutex);
if (m_pendingProcessEvents)