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 |
} |