diff options
author | Morten Johan Sørvig <morten.sorvig@qt.io> | 2021-12-21 12:36:09 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-01-06 01:12:18 +0000 |
commit | 9ed29163a87797c131b8f141a126dd96c4e09efd (patch) | |
tree | f1cd7e8b8963b19a0dd0329bc79496f792878a68 | |
parent | 26ffd0d2ba37621ee3395c4fbbc735857a22b350 (diff) |
wasm: don’t exit on clean return from main()
Qt 6 uses Emcripten’s default of not exiting the runtime
when main() exits. Make qtloader not transition to
the “Exited” state when main() exits with code 0, since
this would hide the app canvas.
(The app state tracking code in qtloader is by now
outdated, and should be revisited.)
Change-Id: Ib47898f1dd93d87b2675f20cd39f96ac3cb681a7
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit 08ea8aaa8b5f0086819ce43c16acff3a45c6e450)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/plugins/platforms/wasm/qtloader.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/plugins/platforms/wasm/qtloader.js b/src/plugins/platforms/wasm/qtloader.js index 1180e55f73..08bf0ed421 100644 --- a/src/plugins/platforms/wasm/qtloader.js +++ b/src/plugins/platforms/wasm/qtloader.js @@ -407,6 +407,12 @@ function QtLoader(config) setStatus("Exited"); }; self.moduleConfig.quit = self.moduleConfig.quit || function(code, exception) { + + // Emscripten (and Qt) supports exiting from main() while keeping the app + // running. Don't transition into the "Exited" state for clean exits. + if (code == 0) + return; + if (exception.name == "ExitStatus") { // Clean exit with code publicAPI.exitText = undefined |