unotest/source/embindtest/embindtest.js |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit edfe8adcec43241ad052c7c82b44e14bd443323b
Author:     Stephan Bergmann <stephan.bergm...@allotropia.de>
AuthorDate: Thu Apr 18 14:29:28 2024 +0200
Commit:     Stephan Bergmann <stephan.bergm...@allotropia.de>
CommitDate: Thu Apr 18 20:58:50 2024 +0200

    Embind: call decrementExceptionRefcount upon catching
    
    The note at
    
<https://emscripten.org/docs/porting/exceptions.html#handling-c-exceptions-from-javascript>
    is a bit vague whether decrementExceptionRefcount would only be needed for
    Wasm-based (-fwasm-exceptions) exceptions, or also for the JS-based
    (-fexceptions) ones that we currently use.  (But it does state clearly that 
for
    the latter we need to manually call incrementExceptionRefcount first.)
    
    Change-Id: I7714935607c990385f68730d02e367e70fa0ea03
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166250
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <stephan.bergm...@allotropia.de>

diff --git a/unotest/source/embindtest/embindtest.js 
b/unotest/source/embindtest/embindtest.js
index 8da18fbb7d96..08bded0c81f8 100644
--- a/unotest/source/embindtest/embindtest.js
+++ b/unotest/source/embindtest/embindtest.js
@@ -540,9 +540,14 @@ Module.addOnPostRun(function() {
     try {
         test.throwRuntimeException();
     } catch (e) {
+        incrementExceptionRefcount(e);
+            //TODO, needed when building with JS-based -fexceptions, see
+            // <https://github.com/emscripten-core/emscripten/issues/17115> 
"[EH] Fix inconsistency
+            // of refcounting in Emscripten EH vs. Wasm EH"
         console.assert(e.name === 'com::sun::star::uno::RuntimeException');
         console.assert(e.message === undefined); //TODO
         //TODO: console.assert(e.Message.startsWith('test'));
+        decrementExceptionRefcount(e);
     }
     const obj = {
         implRefcount: 0,

Reply via email to