diff options
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_wasm.cpp | 18 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_wasm_p.h | 1 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_wasm.cpp b/src/corelib/kernel/qeventdispatcher_wasm.cpp index 14e384b98d..61b49fdc55 100644 --- a/src/corelib/kernel/qeventdispatcher_wasm.cpp +++ b/src/corelib/kernel/qeventdispatcher_wasm.cpp @@ -206,6 +206,9 @@ bool QEventDispatcherWasm::processEvents(QEventLoop::ProcessEventsFlags flags) qCDebug(lcEventDispatcher) << "QEventDispatcherWasm::processEvents flags" << flags << "pending events" << hasPendingEvents; + if (flags & QEventLoop::DialogExec) + handleDialogExec(); + if (!(flags & QEventLoop::ExcludeUserInputEvents)) pollForNativeEvents(); @@ -361,6 +364,21 @@ void QEventDispatcherWasm::wakeUp() emscripten_async_call(&QEventDispatcherWasm::callProcessEvents, this, 0); } +void QEventDispatcherWasm::handleDialogExec() +{ +#if !QT_HAVE_EMSCRIPTEN_ASYNCIFY + qWarning() << "Warning: dialog exec() is not supported on Qt for WebAssembly in this" + << "configuration. Please use show() instead, or enable experimental support" + << "for asyncify.\n" + << "When using exec() (without asyncify) the dialog will show, the user can interact" + << "with it and the appropriate signals will be emitted on close. However, the" + << "exec() call never returns, stack content at the time of the exec() call" + << "is leaked, and the exec() call may interfere with input event processing"; + emscripten_sleep(1); // This call never returns +#endif + // For the asyncify case we do nothing here and wait for events in waitForForEvents() +} + void QEventDispatcherWasm::pollForNativeEvents() { // Secondary thread event dispatchers do not support native events diff --git a/src/corelib/kernel/qeventdispatcher_wasm_p.h b/src/corelib/kernel/qeventdispatcher_wasm_p.h index 2fcd512773..75db11723c 100644 --- a/src/corelib/kernel/qeventdispatcher_wasm_p.h +++ b/src/corelib/kernel/qeventdispatcher_wasm_p.h @@ -90,6 +90,7 @@ private: bool isMainThreadEventDispatcher(); bool isSecondaryThreadEventDispatcher(); + void handleDialogExec(); void pollForNativeEvents(); bool waitForForEvents(); static void callProcessEvents(void *eventDispatcher); |