summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/wasm/qwasmeventdispatcher.cpp
diff options
context:
space:
mode:
authorMorten Sørvig <morten.sorvig@qt.io>2021-06-07 10:46:00 +0200
committerMorten Johan Sørvig <morten.sorvig@qt.io>2021-08-19 18:41:52 +0200
commit16e5bcb4acb08f951268fd872d8260657f46d8c1 (patch)
tree400559b63cd4b4d1884b732cb2e43f5400ec93ba /src/plugins/platforms/wasm/qwasmeventdispatcher.cpp
parenta4a13949a882484c4ab54c94fbbe58bf7b366a93 (diff)
wasm: add DialogExec hack back with warning
Previously, this was implemented in QEventLoop. By moving it to the event dispatcher we can target the warning message better and provide a suggested workaround for the dialog case. The behavior is the same as before: call emscripten_sleep(), which throws a Javascript exception and returns control to the browser while leaking the content of the stack. Pick-to: 6.2 Change-Id: I2979fe4fe5923c27713e85b6725614b60a693e93 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins/platforms/wasm/qwasmeventdispatcher.cpp')
-rw-r--r--src/plugins/platforms/wasm/qwasmeventdispatcher.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/plugins/platforms/wasm/qwasmeventdispatcher.cpp b/src/plugins/platforms/wasm/qwasmeventdispatcher.cpp
index 29dbf96883..69a38ecd68 100644
--- a/src/plugins/platforms/wasm/qwasmeventdispatcher.cpp
+++ b/src/plugins/platforms/wasm/qwasmeventdispatcher.cpp
@@ -91,6 +91,16 @@ bool QWasmEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
if (!(flags & QEventLoop::EventLoopExec))
return QUnixEventDispatcherQPA::processEvents(flags);
+ if (flags & QEventLoop::DialogExec) {
+ qWarning() << "Warning: dialog exec() is not supported on Qt for WebAssembly, please use"
+ << "show() instead. When using exec() 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
+ }
+
// Handle processEvents from QEventLoop::exec():
//
// At this point the application has created its root objects on