static/source/unoembindhelpers/PrimaryBindings.cxx |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit ba70a8756361a0659a63a75a7c534d4442d69b23
Author:     Stephan Bergmann <stephan.bergm...@allotropia.de>
AuthorDate: Thu Mar 7 15:09:00 2024 +0100
Commit:     Stephan Bergmann <stephan.bergm...@allotropia.de>
CommitDate: Thu Mar 7 18:38:34 2024 +0100

    Fix Embind'ing of UNO Any getter for sequences
    
    Change-Id: I5c53cb1d244731dac8f9e3f4797a7a155b9a9afa
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164541
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <stephan.bergm...@allotropia.de>

diff --git a/static/source/unoembindhelpers/PrimaryBindings.cxx 
b/static/source/unoembindhelpers/PrimaryBindings.cxx
index 51048dc3edf4..2e5ecac00054 100644
--- a/static/source/unoembindhelpers/PrimaryBindings.cxx
+++ b/static/source/unoembindhelpers/PrimaryBindings.cxx
@@ -306,7 +306,11 @@ EMSCRIPTEN_BINDINGS(PrimaryBindings)
                     return 
emscripten::val(*o3tl::forceAccess<css::uno::Type>(self));
                 case css::uno::TypeClass_SEQUENCE:
                 {
-                    emscripten::internal::WireTypePack 
argv(const_cast<void*>(self.getValue()));
+                    auto const seq = *static_cast<uno_Sequence* 
const*>(self.getValue());
+                    auto const copy = std::malloc(sizeof(uno_Sequence*));
+                    *static_cast<uno_Sequence**>(copy) = seq;
+                    osl_atomic_increment(&seq->nRefCount);
+                    emscripten::internal::WireTypePack argv(std::move(copy));
                     return emscripten::val::take_ownership(
                         _emval_take_value(getTypeId(self.getValueType()), 
argv));
                 }

Reply via email to