summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorStephan Bergmann <stephan.bergmann@allotropia.de>2024-08-07 15:01:25 +0200
committerStephan Bergmann <stephan.bergmann@allotropia.de>2024-08-07 17:18:34 +0200
commit146fafa691e63de00d6030d88626833ab43d7a65 (patch)
tree88128224bb7deb2c1523814dc96e2bc5f32b072b /desktop
parente7aa613e751c159881cb2448d5c7e08549f3fe49 (diff)
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 <stephan.bergmann@allotropia.de>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/app/sofficemain.cxx15
1 files changed, 13 insertions, 2 deletions
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
+ // <https://emscripten.org/docs/api_reference/emscripten.h.html#c.emscripten_set_main_loop>
+ // "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
+ // <https://groups.google.com/g/emscripten-discuss/c/xpWDVwyJu-M> "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;