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>
This commit is contained in:
Morten Sørvig 2021-06-07 10:46:00 +02:00 committed by Morten Johan Sørvig
parent a4a13949a8
commit 16e5bcb4ac

View File

@ -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