From 16e5bcb4acb08f951268fd872d8260657f46d8c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20S=C3=B8rvig?= Date: Mon, 7 Jun 2021 10:46:00 +0200 Subject: [PATCH] wasm: add DialogExec hack back with warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ø --- src/plugins/platforms/wasm/qwasmeventdispatcher.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/plugins/platforms/wasm/qwasmeventdispatcher.cpp b/src/plugins/platforms/wasm/qwasmeventdispatcher.cpp index 29dbf96883b..69a38ecd68d 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