From 08ea8aaa8b5f0086819ce43c16acff3a45c6e450 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Tue, 21 Dec 2021 12:36:09 +0100 Subject: [PATCH] =?UTF-8?q?wasm:=20don=E2=80=99t=20exit=20on=20clean=20ret?= =?UTF-8?q?urn=20from=20main()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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.) Pick-to: 6.3 Change-Id: Ib47898f1dd93d87b2675f20cd39f96ac3cb681a7 Reviewed-by: David Skoland Reviewed-by: Lorn Potter --- src/plugins/platforms/wasm/qtloader.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/plugins/platforms/wasm/qtloader.js b/src/plugins/platforms/wasm/qtloader.js index 1180e55f73e..08bf0ed421c 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