diff options
author | Mikolaj Boc <mikolaj.boc@qt.io> | 2023-06-16 15:53:15 +0200 |
---|---|---|
committer | Mikolaj Boc <mikolaj.boc@qt.io> | 2023-06-17 00:13:21 +0200 |
commit | b96a38acd2b8dd0b9590daa9498adcf5343797cc (patch) | |
tree | 876903c244f2ac4a795abcb0dd654409f8ae0aa0 /src/corelib/kernel/qeventdispatcher_wasm.cpp | |
parent | 4d1525b0b825f1ea6376956f8c5d7667019931f4 (diff) |
Don't simulate main loop with JSPI
This is not needed, as main loop just works with awaited calls
thanks to JS suspender objects with JSPI enabled.
Fixes: QTBUG-114651
Change-Id: I94e187953ac8cec5c999f1b02508efecc19641f6
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.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_wasm.cpp b/src/corelib/kernel/qeventdispatcher_wasm.cpp index 35ff4b4328..6ae6ea0985 100644 --- a/src/corelib/kernel/qeventdispatcher_wasm.cpp +++ b/src/corelib/kernel/qeventdispatcher_wasm.cpp @@ -431,10 +431,14 @@ void QEventDispatcherWasm::handleApplicationExec() // Note that we don't use asyncify here: Emscripten supports one level of // asyncify only and we want to reserve that for dialog exec() instead of // using it for the one qApp exec(). - const bool simulateInfiniteLoop = true; - emscripten_set_main_loop([](){ - emscripten_pause_main_loop(); - }, 0, simulateInfiniteLoop); + // When JSPI is used, awaited async calls are allowed to be nested, so we + // proceed normally. + if (!qstdweb::haveJspi()) { + const bool simulateInfiniteLoop = true; + emscripten_set_main_loop([](){ + emscripten_pause_main_loop(); + }, 0, simulateInfiniteLoop); + } } void QEventDispatcherWasm::handleDialogExec() |