From 146fafa691e63de00d6030d88626833ab43d7a65 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 7 Aug 2024 15:01:25 +0200 Subject: I finally understand why we need that hack ...that 77129fbb74bcefde4551d494f029169e7c6026e3 "Emscripten: Add hack to prepare for --enable-wasm-exceptions" was puzzled about Change-Id: Iba54a77e3c2a71fe45b97795ca2da0606c3adf41 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171594 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- desktop/source/app/sofficemain.cxx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'desktop/source/app/sofficemain.cxx') diff --git a/desktop/source/app/sofficemain.cxx b/desktop/source/app/sofficemain.cxx index 9470add3b488..bfa1a66d886a 100644 --- a/desktop/source/app/sofficemain.cxx +++ b/desktop/source/app/sofficemain.cxx @@ -75,8 +75,19 @@ extern "C" int DESKTOP_DLLPUBLIC soffice_main() tools::extendApplicationEnvironment(); #if defined EMSCRIPTEN - //TODO, see "Experimental (AKA currently broken) WASM exception + SjLj build" in - // static/README.wasm.md: + //HACK: Qt5 QWasmEventDispatcher::processEvents + // (qtbase/src/plugins/platforms/wasm/qwasmeventdispatcher.cpp) calls + // emscripten_set_main_loop_arg with simulateInfiniteLoop == true, and as we use + // -fwasm-exceptions (cf. solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk), aDesktop allocated on + // the stack would run into the issue warned about at + // + // "Note: Currently, using the new Wasm exception handling and simulate_infinite_loop == true at + // the same time does not work yet in C++ projects that have objects with destructors on the + // stack at the time of the call." (Also see the mailing list thread at + // "Implementation of + // -fexceptions and -fwasm-exceptions" for why such automatic variables are destroyed with + // -fwasm-exceptions but not with -fexceptions.) So deliberately leak the Desktop instance + // here: new desktop::Desktop(); #else desktop::Desktop aDesktop; -- cgit