View | Details | Raw Unified | Return to bug 263596
Collapse All | Expand All

(-)b/editors/libreoffice/Makefile (-8 / +2 lines)
Lines 19-24 BUILD_DEPENDS= p5-Archive-Zip>=0:archivers/p5-Archive-Zip \ Link Here
19
		dmake:devel/dmake \
19
		dmake:devel/dmake \
20
		gperf>=3.1:devel/gperf \
20
		gperf>=3.1:devel/gperf \
21
		${LOCALBASE}/include/libcuckoo/cuckoohash_map.hh:devel/libcuckoo \
21
		${LOCALBASE}/include/libcuckoo/cuckoohash_map.hh:devel/libcuckoo \
22
		libunwind>=20211201_1:devel/libunwind \
22
		mdds>=2.0:devel/mdds \
23
		mdds>=2.0:devel/mdds \
23
		ucpp:devel/ucpp \
24
		ucpp:devel/ucpp \
24
		${LOCALBASE}/include/sane/sane.h:graphics/sane-backends \
25
		${LOCALBASE}/include/sane/sane.h:graphics/sane-backends \
Lines 85-98 LIB_DEPENDS= libapr-1.so:devel/apr1 \ Link Here
85
		libZXing.so:textproc/zxing-cpp \
86
		libZXing.so:textproc/zxing-cpp \
86
		libfontconfig.so:x11-fonts/fontconfig \
87
		libfontconfig.so:x11-fonts/fontconfig \
87
		libxcb-icccm.so:x11/xcb-util-wm \
88
		libxcb-icccm.so:x11/xcb-util-wm \
88
		libserf-1.so:www/serf \
89
		libserf-1.so:www/serf
89
		${LIB_DEPENDS_${ARCH}}
90
LIB_DEPENDS_aarch64=	libunwind.so:devel/libunwind
91
LIB_DEPENDS_amd64=	libunwind.so:devel/libunwind
92
LIB_DEPENDS_armv7=	libunwind.so:devel/libunwind
93
LIB_DEPENDS_i386=	libunwind.so:devel/libunwind
94
LIB_DEPENDS_powerpc64=	libunwind.so:devel/libunwind
95
LIB_DEPENDS_powerpc64le=	libunwind.so:devel/libunwind
96
90
97
RUN_DEPENDS=	xdg-open:devel/xdg-utils \
91
RUN_DEPENDS=	xdg-open:devel/xdg-utils \
98
		${LOCALBASE}/share/fonts/Caladea/Caladea-Bold.ttf:x11-fonts/crosextrafonts-caladea-ttf \
92
		${LOCALBASE}/share/fonts/Caladea/Caladea-Bold.ttf:x11-fonts/crosextrafonts-caladea-ttf \
(-)a/editors/libreoffice/files/patch-bridges_source_cpp__uno_gcc3__linux__aarch64_abi.cxx (-11 lines)
Removed Link Here
1
--- bridges/source/cpp_uno/gcc3_linux_aarch64/abi.cxx.orig	2022-01-26 14:35:29 UTC
2
+++ bridges/source/cpp_uno/gcc3_linux_aarch64/abi.cxx
3
@@ -147,7 +147,7 @@ extern "C" void _GLIBCXX_CDTOR_CALLABI deleteException
4
 extern "C" void _GLIBCXX_CDTOR_CALLABI deleteException(void * exception) {
5
     __cxxabiv1::__cxa_exception * header =
6
         static_cast<__cxxabiv1::__cxa_exception *>(exception) - 1;
7
-#if !defined MACOSX && defined _LIBCPPABI_VERSION // detect libc++abi
8
+#if 1
9
     // First, the libcxxabi commit
10
     // <http://llvm.org/viewvc/llvm-project?view=revision&revision=303175>
11
     // "[libcxxabi] Align unwindHeader on a double-word boundary" towards
(-)b/editors/libreoffice/files/patch-bridges_source_cpp__uno_gcc3__linux__aarch64_uno2cpp.cxx (+25 lines)
Added Link Here
1
--- bridges/source/cpp_uno/gcc3_linux_aarch64/uno2cpp.cxx.orig	2022-03-23 13:32:00 UTC
2
+++ bridges/source/cpp_uno/gcc3_linux_aarch64/uno2cpp.cxx
3
@@ -304,8 +304,10 @@ void call(
4
                 "C++ code threw unknown exception");
5
         }
6
     } catch (css::uno::Exception &) {
7
-        __cxxabiv1::__cxa_exception * header = reinterpret_cast<__cxxabiv1::__cxa_eh_globals *>(
8
-            __cxxabiv1::__cxa_get_globals())->caughtExceptions;
9
+        __cxxabiv1::__cxa_exception * header =
10
+            reinterpret_cast<__cxxabiv1::__cxa_exception *>(
11
+                 __cxxabiv1::__cxa_current_primary_exception());
12
+        __cxxabiv1::__cxa_decrement_exception_refcount(header);
13
 #if !defined MACOSX && defined _LIBCPPABI_VERSION // detect libc++abi
14
         // Very bad HACK to find out whether we run against a libcxxabi that has a new
15
         // __cxa_exception::reserved member at the start, introduced with LLVM 10
16
@@ -335,8 +337,7 @@ void call(
17
         }
18
 #endif
19
         abi_aarch64::mapException(
20
-            header,
21
-            __cxxabiv1::__cxa_current_exception_type(), *exception,
22
+            header - 1, header[-1].exceptionType, *exception,
23
             proxy->getBridge()->getCpp2Uno());
24
         for (sal_Int32 i = 0; i != count; ++i) {
25
             if (cppArgs[i] != nullptr) {
(-)b/editors/libreoffice/files/patch-bridges_source_cpp__uno_gcc3__linux__intel_except.cxx (-7 / +53 lines)
Lines 1-14 Link Here
1
Fix uno bridge exception handling on i386.  This matches the amd64
1
--- bridges/source/cpp_uno/gcc3_linux_intel/except.cxx.orig	2022-03-23 13:32:00 UTC
2
implementation and fixes a segfault in code that uses uno exceptions.
3
4
--- bridges/source/cpp_uno/gcc3_linux_intel/except.cxx.orig	2020-11-22 14:05:28 UTC
5
+++ bridges/source/cpp_uno/gcc3_linux_intel/except.cxx
2
+++ bridges/source/cpp_uno/gcc3_linux_intel/except.cxx
6
@@ -202,7 +202,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescrip
3
@@ -202,9 +202,15 @@ static void _GLIBCXX_CDTOR_CALLABI deleteException( vo
7
 extern "C" {
4
 extern "C" {
8
 static void _GLIBCXX_CDTOR_CALLABI deleteException( void * pExc )
5
 static void _GLIBCXX_CDTOR_CALLABI deleteException( void * pExc )
9
 {
6
 {
10
-    __cxa_exception const * header = static_cast<__cxa_exception const *>(pExc) - 1;
7
-    __cxa_exception const * header = static_cast<__cxa_exception const *>(pExc) - 1;
11
+    __cxxabiv1::__cxa_exception const * header = (static_cast<__cxxabiv1::__cxa_exception const *>(pExc) - 1);
8
+    __cxxabiv1::__cxa_exception * header =
9
+        reinterpret_cast<__cxxabiv1::__cxa_exception *>(pExc);
10
+    if (header[-1].exceptionDestructor != &deleteException) {
11
+        header = reinterpret_cast<__cxxabiv1::__cxa_exception *>(
12
+            reinterpret_cast<char *>(header) - 12);
13
+    }
14
+    assert(header[-1].exceptionDestructor == &deleteException);
12
     typelib_TypeDescription * pTD = nullptr;
15
     typelib_TypeDescription * pTD = nullptr;
13
     OUString unoName( toUNOname( header->exceptionType->name() ) );
16
-    OUString unoName( toUNOname( header->exceptionType->name() ) );
17
+    OUString unoName( toUNOname( header[-1].exceptionType->name() ) );
14
     ::typelib_typedescription_getByName( &pTD, unoName.pData );
18
     ::typelib_typedescription_getByName( &pTD, unoName.pData );
19
     assert(pTD && "### unknown exception type! leaving out destruction => leaking!!!");
20
     if (pTD)
21
@@ -262,8 +268,19 @@ void fillUnoException(uno_Any * pUnoExc, uno_Mapping *
22
 
23
 void fillUnoException(uno_Any * pUnoExc, uno_Mapping * pCpp2Uno)
24
 {
25
-    __cxa_exception * header = reinterpret_cast<CPPU_CURRENT_NAMESPACE::__cxa_eh_globals*>(
26
-                 __cxxabiv1::__cxa_get_globals())->caughtExceptions;
27
+    __cxxabiv1::__cxa_exception * header =
28
+        reinterpret_cast<__cxxabiv1::__cxa_exception *>(
29
+             __cxxabiv1::__cxa_current_primary_exception());
30
+    if (header) {
31
+        __cxxabiv1::__cxa_decrement_exception_refcount(header);
32
+        if (header[-1].exceptionDestructor != &deleteException) {
33
+            header = reinterpret_cast<__cxxabiv1::__cxa_exception *>(
34
+                reinterpret_cast<char *>(header) - 12);
35
+            if (header[-1].exceptionDestructor != &deleteException) {
36
+                header = nullptr;
37
+            }
38
+        }
39
+    }
40
     if (! header)
41
     {
42
         RuntimeException aRE( "no exception header!" );
43
@@ -273,7 +290,7 @@ void fillUnoException(uno_Any * pUnoExc, uno_Mapping *
44
         return;
45
     }
46
 
47
-    std::type_info *exceptionType = __cxxabiv1::__cxa_current_exception_type();
48
+    std::type_info *exceptionType = header[-1].exceptionType;
49
 
50
     typelib_TypeDescription * pExcTypeDescr = nullptr;
51
     OUString unoName( toUNOname( exceptionType->name() ) );
52
@@ -292,7 +309,7 @@ void fillUnoException(uno_Any * pUnoExc, uno_Mapping *
53
     else
54
     {
55
         // construct uno exception any
56
-        uno_any_constructAndConvert( pUnoExc, header->adjustedPtr, pExcTypeDescr, pCpp2Uno );
57
+        uno_any_constructAndConvert( pUnoExc, header[-1].adjustedPtr, pExcTypeDescr, pCpp2Uno );
58
         typelib_typedescription_release( pExcTypeDescr );
59
     }
60
 }
(-)b/editors/libreoffice/files/patch-bridges_source_cpp__uno_gcc3__linux__x86-64_except.cxx (-9 / +37 lines)
Lines 1-11 Link Here
1
--- bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx.orig	2022-01-26 14:35:29 UTC
1
--- bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx.orig	2022-03-23 13:32:00 UTC
2
+++ bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx
2
+++ bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx
3
@@ -82,7 +82,7 @@ static void _GLIBCXX_CDTOR_CALLABI deleteException( vo
3
@@ -193,7 +193,9 @@ void fillUnoException(uno_Any * pUnoExc, uno_Mapping *
4
 static void _GLIBCXX_CDTOR_CALLABI deleteException( void * pExc )
4
 
5
 void fillUnoException(uno_Any * pUnoExc, uno_Mapping * pCpp2Uno)
5
 {
6
 {
6
     __cxxabiv1::__cxa_exception const * header = static_cast<__cxxabiv1::__cxa_exception const *>(pExc) - 1;
7
-    __cxxabiv1::__cxa_exception * header = __cxxabiv1::__cxa_get_globals()->caughtExceptions;
7
-#if defined _LIBCPPABI_VERSION // detect libc++abi
8
+    __cxxabiv1::__cxa_exception * header =
8
+#if 1
9
+        reinterpret_cast<__cxxabiv1::__cxa_exception *>(
9
     // First, the libcxxabi commit
10
+             __cxxabiv1::__cxa_current_primary_exception());
10
     // <http://llvm.org/viewvc/llvm-project?view=revision&revision=303175>
11
     if (! header)
11
     // "[libcxxabi] Align unwindHeader on a double-word boundary" towards
12
     {
13
         RuntimeException aRE( "no exception header!" );
14
@@ -202,6 +204,7 @@ void fillUnoException(uno_Any * pUnoExc, uno_Mapping *
15
         SAL_WARN("bridges", aRE.Message);
16
         return;
17
     }
18
+    __cxxabiv1::__cxa_decrement_exception_refcount(header);
19
 
20
 #if defined _LIBCPPABI_VERSION // detect libc++abi
21
     // Very bad HACK to find out whether we run against a libcxxabi that has a new
22
@@ -231,7 +234,7 @@ void fillUnoException(uno_Any * pUnoExc, uno_Mapping *
23
     }
24
 #endif
25
 
26
-    std::type_info *exceptionType = __cxxabiv1::__cxa_current_exception_type();
27
+    std::type_info *exceptionType = header[-1].exceptionType;
28
 
29
     typelib_TypeDescription * pExcTypeDescr = nullptr;
30
     OUString unoName( toUNOname( exceptionType->name() ) );
31
@@ -250,7 +253,7 @@ void fillUnoException(uno_Any * pUnoExc, uno_Mapping *
32
     else
33
     {
34
         // construct uno exception any
35
-        uno_any_constructAndConvert( pUnoExc, header->adjustedPtr, pExcTypeDescr, pCpp2Uno );
36
+        uno_any_constructAndConvert( pUnoExc, header[-1].adjustedPtr, pExcTypeDescr, pCpp2Uno );
37
         typelib_typedescription_release( pExcTypeDescr );
38
     }
39
 }
(-)b/editors/libreoffice/files/powerpc64/patch-bridges-source-cpp_uno-gcc3_linux_powerpc-except.cxx (-25 / +49 lines)
Lines 1-14 Link Here
1
--- bridges/source/cpp_uno/gcc3_linux_powerpc/except.cxx.orig	2019-12-05 13:59:23.000000000 -0600
1
--- bridges/source/cpp_uno/gcc3_linux_powerpc/except.cxx.orig	2022-03-23 13:32:00 UTC
2
+++ bridges/source/cpp_uno/gcc3_linux_powerpc/except.cxx	2020-09-14 11:24:58.489149000 -0500
2
+++ bridges/source/cpp_uno/gcc3_linux_powerpc/except.cxx
3
@@ -24,6 +24,7 @@
3
@@ -25,6 +25,7 @@
4
 #include <cxxabi.h>
4
 
5
 #include <rtl/strbuf.hxx>
5
 #include <rtl/strbuf.hxx>
6
 #include <rtl/ustrbuf.hxx>
6
 #include <rtl/ustrbuf.hxx>
7
+#include <sal/log.hxx>
7
+#include <sal/log.hxx>
8
 #include <osl/mutex.hxx>
8
 #include <osl/mutex.hxx>
9
 
9
 
10
 #include <com/sun/star/uno/genfunc.hxx>
10
 #include <com/sun/star/uno/genfunc.hxx>
11
@@ -136,7 +137,7 @@
11
@@ -136,7 +137,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescrip
12
         buf.append( 'E' );
12
         buf.append( 'E' );
13
 
13
 
14
         OString symName( buf.makeStringAndClear() );
14
         OString symName( buf.makeStringAndClear() );
Lines 17-23 Link Here
17
 
17
 
18
         if (rtti)
18
         if (rtti)
19
         {
19
         {
20
@@ -161,9 +162,9 @@
20
@@ -161,9 +162,9 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescrip
21
                 {
21
                 {
22
                     // ensure availability of base
22
                     // ensure availability of base
23
                     type_info * base_rtti = getRTTI(
23
                     type_info * base_rtti = getRTTI(
Lines 29-46 Link Here
29
                 }
29
                 }
30
                 else
30
                 else
31
                 {
31
                 {
32
@@ -192,8 +193,8 @@
32
@@ -192,9 +193,15 @@ static void deleteException( void * pExc )
33
 
33
 
34
 static void deleteException( void * pExc )
34
 static void deleteException( void * pExc )
35
 {
35
 {
36
-    __cxa_exception const * header = ((__cxa_exception const *)pExc - 1);
36
-    __cxa_exception const * header = ((__cxa_exception const *)pExc - 1);
37
-    typelib_TypeDescription * pTD = 0;
37
-    typelib_TypeDescription * pTD = 0;
38
+    __cxxabiv1::__cxa_exception const * header = static_cast<__cxxabiv1::__cxa_exception const *>(pExc) - 1;
38
-    OUString unoName( toUNOname( header->exceptionType->name() ) );
39
+    __cxxabiv1::__cxa_exception * header =
40
+        reinterpret_cast<__cxxabiv1::__cxa_exception *>(pExc);
41
+    if (header[-1].exceptionDestructor != &deleteException) {
42
+        header = reinterpret_cast<__cxxabiv1::__cxa_exception *>(
43
+            reinterpret_cast<char *>(header) - 12);
44
+    }
45
+    assert(header[-1].exceptionDestructor == &deleteException);
39
+    typelib_TypeDescription * pTD = nullptr;
46
+    typelib_TypeDescription * pTD = nullptr;
40
     OUString unoName( toUNOname( header->exceptionType->name() ) );
47
+    OUString unoName( toUNOname( header[-1].exceptionType->name() ) );
41
     ::typelib_typedescription_getByName( &pTD, unoName.pData );
48
     ::typelib_typedescription_getByName( &pTD, unoName.pData );
42
     assert(pTD && "### unknown exception type! leaving out destruction => leaking!!!");
49
     assert(pTD && "### unknown exception type! leaving out destruction => leaking!!!");
43
@@ -216,39 +217,57 @@
50
     if (pTD)
51
@@ -218,39 +225,68 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * 
44
     if (! pTypeDescr)
52
     if (! pTypeDescr)
45
         terminate();
53
         terminate();
46
 
54
 
Lines 69-112 Link Here
69
+    __cxxabiv1::__cxa_throw( pCppExc, rtti, deleteException );
77
+    __cxxabiv1::__cxa_throw( pCppExc, rtti, deleteException );
70
 }
78
 }
71
 
79
 
72
 void fillUnoException(uno_Any * pExc, uno_Mapping * pCpp2Uno)
80
-void fillUnoException(uno_Any * pExc, uno_Mapping * pCpp2Uno)
81
+void fillUnoException(uno_Any * pUnoExc, uno_Mapping * pCpp2Uno)
73
 {
82
 {
74
-    __cxa_exception * header = __cxa_get_globals()->caughtExceptions;
83
-    __cxa_exception * header = __cxa_get_globals()->caughtExceptions;
75
+    __cxxabiv1::__cxa_exception * header = 
84
+    __cxxabiv1::__cxa_exception * header =
76
+                 __cxxabiv1::__cxa_get_globals()->caughtExceptions;
85
+        reinterpret_cast<__cxxabiv1::__cxa_exception *>(
86
+             __cxxabiv1::__cxa_current_primary_exception());
87
+    if (header) {
88
+        __cxxabiv1::__cxa_decrement_exception_refcount(header);
89
+        if (header[-1].exceptionDestructor != &deleteException) {
90
+            header = reinterpret_cast<__cxxabiv1::__cxa_exception *>(
91
+                reinterpret_cast<char *>(header) - 12);
92
+            if (header[-1].exceptionDestructor != &deleteException) {
93
+                header = nullptr;
94
+            }
95
+        }
96
+    }
77
     if (! header)
97
     if (! header)
78
         terminate();
98
-        terminate();
99
+    {
100
+        RuntimeException aRE( "no exception header!" );
101
+        Type const & rType = cppu::UnoType<decltype(aRE)>::get();
102
+        uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno );
103
+        SAL_WARN("bridges", aRE.Message);
104
+        return;
105
+    }
79
 
106
 
80
-    std::type_info *exceptionType = __cxa_current_exception_type();
107
-    std::type_info *exceptionType = __cxa_current_exception_type();
81
+    std::type_info *exceptionType = __cxxabiv1::__cxa_current_exception_type();
108
+    std::type_info *exceptionType = header[-1].exceptionType;
82
 
109
 
83
-    typelib_TypeDescription * pExcTypeDescr = 0;
110
-    typelib_TypeDescription * pExcTypeDescr = 0;
84
+    typelib_TypeDescription * pExcTypeDescr = nullptr;
111
+    typelib_TypeDescription * pExcTypeDescr = nullptr;
85
     OUString unoName( toUNOname( exceptionType->name() ) );
112
     OUString unoName( toUNOname( exceptionType->name() ) );
86
-    ::typelib_typedescription_getByName( &pExcTypeDescr, unoName.pData );
113
-    ::typelib_typedescription_getByName( &pExcTypeDescr, unoName.pData );
87
-    if (! pExcTypeDescr)
114
-    if (! pExcTypeDescr)
115
-        terminate();
116
-
117
-    // construct uno exception any
118
-    ::uno_any_constructAndConvert( pExc, header->adjustedPtr, pExcTypeDescr, pCpp2Uno );
119
-    ::typelib_typedescription_release( pExcTypeDescr );
88
+    typelib_typedescription_getByName( &pExcTypeDescr, unoName.pData );
120
+    typelib_typedescription_getByName( &pExcTypeDescr, unoName.pData );
89
+    if (pExcTypeDescr == nullptr)
121
+    if (pExcTypeDescr == nullptr)
90
+    {
122
+    {
91
+        RuntimeException aRE( "exception type not found: " + unoName );
123
+        RuntimeException aRE( "exception type not found: " + unoName );
92
+        Type const & rType = cppu::UnoType<decltype(aRE)>::get();
124
+        Type const & rType = cppu::UnoType<decltype(aRE)>::get();
93
+        uno_type_any_constructAndConvert( pExc, &aRE, rType.getTypeLibType(), pCpp2Uno );
125
+        uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno );
94
+        SAL_WARN("bridges", aRE.Message);
126
+        SAL_WARN("bridges", aRE.Message);
95
+    }
127
+    }
96
+    else
128
+    else
97
+    {
129
+    {
98
+        // construct uno exception any
130
+        // construct uno exception any
99
+        uno_any_constructAndConvert( pExc, header->adjustedPtr, pExcTypeDescr, pCpp2Uno );
131
+        uno_any_constructAndConvert( pUnoExc, header[-1].adjustedPtr, pExcTypeDescr, pCpp2Uno );
100
+        typelib_typedescription_release( pExcTypeDescr );
132
+        typelib_typedescription_release( pExcTypeDescr );
101
+    }
133
+    }
102
+    if (nullptr == pExcTypeDescr)
103
         terminate();
104
 
105
     // construct uno exception any
106
-    ::uno_any_constructAndConvert( pExc, header->adjustedPtr, pExcTypeDescr, pCpp2Uno );
107
-    ::typelib_typedescription_release( pExcTypeDescr );
108
+    uno_any_constructAndConvert( pExc, header->adjustedPtr, pExcTypeDescr, pCpp2Uno );
109
+    typelib_typedescription_release( pExcTypeDescr );
110
 }
134
 }
111
 
135
 
112
 }
136
 }
(-)b/editors/libreoffice/files/powerpc64/patch-bridges-source-cpp_uno-gcc3_linux_powerpc64-except.cxx (-23 / +30 lines)
Lines 1-5 Link Here
1
--- bridges/source/cpp_uno/gcc3_linux_powerpc64/except.cxx.orig	2019-12-05 13:59:23.000000000 -0600
1
--- bridges/source/cpp_uno/gcc3_linux_powerpc64/except.cxx.orig	2022-03-23 13:32:00 UTC
2
+++ bridges/source/cpp_uno/gcc3_linux_powerpc64/except.cxx	2020-09-14 11:24:58.489149000 -0500
2
+++ bridges/source/cpp_uno/gcc3_linux_powerpc64/except.cxx
3
@@ -24,6 +24,7 @@
3
@@ -24,6 +24,7 @@
4
 #include <cxxabi.h>
4
 #include <cxxabi.h>
5
 #include <rtl/strbuf.hxx>
5
 #include <rtl/strbuf.hxx>
Lines 8-14 Link Here
8
 #include <osl/mutex.hxx>
8
 #include <osl/mutex.hxx>
9
 
9
 
10
 #include <com/sun/star/uno/genfunc.hxx>
10
 #include <com/sun/star/uno/genfunc.hxx>
11
@@ -136,7 +137,7 @@
11
@@ -136,7 +137,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescrip
12
         buf.append( 'E' );
12
         buf.append( 'E' );
13
 
13
 
14
         OString symName( buf.makeStringAndClear() );
14
         OString symName( buf.makeStringAndClear() );
Lines 17-23 Link Here
17
 
17
 
18
         if (rtti)
18
         if (rtti)
19
         {
19
         {
20
@@ -161,9 +162,9 @@
20
@@ -161,9 +162,9 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescrip
21
                 {
21
                 {
22
                     // ensure availability of base
22
                     // ensure availability of base
23
                     type_info * base_rtti = getRTTI(
23
                     type_info * base_rtti = getRTTI(
Lines 29-46 Link Here
29
                 }
29
                 }
30
                 else
30
                 else
31
                 {
31
                 {
32
@@ -192,8 +193,8 @@
32
@@ -192,8 +193,9 @@ static void deleteException( void * pExc )
33
 
33
 
34
 static void deleteException( void * pExc )
34
 static void deleteException( void * pExc )
35
 {
35
 {
36
-    __cxa_exception const * header = ((__cxa_exception const *)pExc - 1);
36
-    __cxa_exception const * header = ((__cxa_exception const *)pExc - 1);
37
-    typelib_TypeDescription * pTD = 0;
37
-    typelib_TypeDescription * pTD = 0;
38
+    __cxxabiv1::__cxa_exception const * header = static_cast<__cxxabiv1::__cxa_exception const *>(pExc) - 1;
38
+    __cxxabiv1::__cxa_exception * header =
39
+        reinterpret_cast<__cxxabiv1::__cxa_exception *>(pExc) - 1;
39
+    typelib_TypeDescription * pTD = nullptr;
40
+    typelib_TypeDescription * pTD = nullptr;
40
     OUString unoName( toUNOname( header->exceptionType->name() ) );
41
     OUString unoName( toUNOname( header->exceptionType->name() ) );
41
     ::typelib_typedescription_getByName( &pTD, unoName.pData );
42
     ::typelib_typedescription_getByName( &pTD, unoName.pData );
42
     assert(pTD && "### unknown exception type! leaving out destruction => leaking!!!");
43
     assert(pTD && "### unknown exception type! leaving out destruction => leaking!!!");
43
@@ -216,39 +217,57 @@
44
@@ -216,39 +218,59 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * 
44
     if (! pTypeDescr)
45
     if (! pTypeDescr)
45
         terminate();
46
         terminate();
46
 
47
 
Lines 69-112 Link Here
69
+    __cxxabiv1::__cxa_throw( pCppExc, rtti, deleteException );
70
+    __cxxabiv1::__cxa_throw( pCppExc, rtti, deleteException );
70
 }
71
 }
71
 
72
 
72
 void fillUnoException(uno_Any * pExc, uno_Mapping * pCpp2Uno)
73
-void fillUnoException(uno_Any * pExc, uno_Mapping * pCpp2Uno)
74
+void fillUnoException(uno_Any * pUnoExc, uno_Mapping * pCpp2Uno)
73
 {
75
 {
74
-    __cxa_exception * header = __cxa_get_globals()->caughtExceptions;
76
-    __cxa_exception * header = __cxa_get_globals()->caughtExceptions;
75
+    __cxxabiv1::__cxa_exception * header = 
77
+    __cxxabiv1::__cxa_exception * header =
76
+                 __cxxabiv1::__cxa_get_globals()->caughtExceptions;
78
+        reinterpret_cast<__cxxabiv1::__cxa_exception *>(
79
+             __cxxabiv1::__cxa_current_primary_exception());
77
     if (! header)
80
     if (! header)
78
         terminate();
81
-        terminate();
82
+    {
83
+        RuntimeException aRE( "no exception header!" );
84
+        Type const & rType = cppu::UnoType<decltype(aRE)>::get();
85
+        uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno );
86
+        SAL_WARN("bridges", aRE.Message);
87
+        return;
88
+    }
89
+    __cxxabiv1::__cxa_decrement_exception_refcount(header);
79
 
90
 
80
-    std::type_info *exceptionType = __cxa_current_exception_type();
91
-    std::type_info *exceptionType = __cxa_current_exception_type();
81
+    std::type_info *exceptionType = __cxxabiv1::__cxa_current_exception_type();
92
+    std::type_info *exceptionType = header[-1].exceptionType;
82
 
93
 
83
-    typelib_TypeDescription * pExcTypeDescr = 0;
94
-    typelib_TypeDescription * pExcTypeDescr = 0;
84
+    typelib_TypeDescription * pExcTypeDescr = nullptr;
95
+    typelib_TypeDescription * pExcTypeDescr = nullptr;
85
     OUString unoName( toUNOname( exceptionType->name() ) );
96
     OUString unoName( toUNOname( exceptionType->name() ) );
86
-    ::typelib_typedescription_getByName( &pExcTypeDescr, unoName.pData );
97
-    ::typelib_typedescription_getByName( &pExcTypeDescr, unoName.pData );
87
-    if (! pExcTypeDescr)
98
-    if (! pExcTypeDescr)
99
-        terminate();
100
-
101
-    // construct uno exception any
102
-    ::uno_any_constructAndConvert( pExc, header->adjustedPtr, pExcTypeDescr, pCpp2Uno );
103
-    ::typelib_typedescription_release( pExcTypeDescr );
88
+    typelib_typedescription_getByName( &pExcTypeDescr, unoName.pData );
104
+    typelib_typedescription_getByName( &pExcTypeDescr, unoName.pData );
89
+    if (pExcTypeDescr == nullptr)
105
+    if (pExcTypeDescr == nullptr)
90
+    {
106
+    {
91
+        RuntimeException aRE( "exception type not found: " + unoName );
107
+        RuntimeException aRE( "exception type not found: " + unoName );
92
+        Type const & rType = cppu::UnoType<decltype(aRE)>::get();
108
+        Type const & rType = cppu::UnoType<decltype(aRE)>::get();
93
+        uno_type_any_constructAndConvert( pExc, &aRE, rType.getTypeLibType(), pCpp2Uno );
109
+        uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno );
94
+        SAL_WARN("bridges", aRE.Message);
110
+        SAL_WARN("bridges", aRE.Message);
95
+    }
111
+    }
96
+    else
112
+    else
97
+    {
113
+    {
98
+        // construct uno exception any
114
+        // construct uno exception any
99
+        uno_any_constructAndConvert( pExc, header->adjustedPtr, pExcTypeDescr, pCpp2Uno );
115
+        uno_any_constructAndConvert( pUnoExc, header[-1].adjustedPtr, pExcTypeDescr, pCpp2Uno );
100
+        typelib_typedescription_release( pExcTypeDescr );
116
+        typelib_typedescription_release( pExcTypeDescr );
101
+    }
117
+    }
102
+    if (nullptr == pExcTypeDescr)
103
         terminate();
104
 
105
     // construct uno exception any
106
-    ::uno_any_constructAndConvert( pExc, header->adjustedPtr, pExcTypeDescr, pCpp2Uno );
107
-    ::typelib_typedescription_release( pExcTypeDescr );
108
+    uno_any_constructAndConvert( pExc, header->adjustedPtr, pExcTypeDescr, pCpp2Uno );
109
+    typelib_typedescription_release( pExcTypeDescr );
110
 }
118
 }
111
 
119
 
112
 }
120
 }
113
- 

Return to bug 263596