diff options
author | Morten Johan Sørvig <morten.sorvig@qt.io> | 2021-08-18 14:34:55 +0200 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@qt.io> | 2021-09-08 19:01:54 +0200 |
commit | a72066f449cefecb2cf6c822b0040b082d0b4156 (patch) | |
tree | baa2b4734b8daced3957a8135e86d4b58884792c /src/corelib/kernel/qeventdispatcher_wasm.cpp | |
parent | 04fd894400325fc26af739ff289c3f457acdb41d (diff) |
wasm: add DialogExec hack/warning to event dispatcher
Show the warning (and call emscripten_sleep) for the standard
build, but not for the asyncify build.
Change-Id: I695a580ea60897872beee6fa2b6ae70acb9e7dcf
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/corelib/kernel/qeventdispatcher_wasm.cpp')
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_wasm.cpp | 18 |
1 files changed, 18 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 |