[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 2 commits - bridges/source ucb/source

Herbert Dürr hdu at apache.org
Thu Mar 27 09:08:27 PDT 2014


 bridges/source/cpp_uno/s5abi_macosx_x86-64/except.cxx |   19 ++++++++++++++----
 bridges/source/cpp_uno/s5abi_macosx_x86-64/share.hxx  |    4 +++
 ucb/source/ucp/webdav/webdavcontent.cxx               |   17 ++++++++++++++++
 3 files changed, 36 insertions(+), 4 deletions(-)

New commits:
commit a5df560f6a44de04a66da1dd05960ff2ee6bd2ba
Author: Herbert Dürr <hdu at apache.org>
Date:   Thu Mar 27 15:50:58 2014 +0000

    #i124421# force the availability of type_info symbols thrown by the ucb module
    
    When exceptions are passed around in uno::Any types to be thrown later it
    was observed on OSX64 that the type_info symbols of these exceptions were
    not available anywhere. On most platforms the UNO bridge would synthesize
    them by emulating how the platform's toolchain would do it. Forcing the
    emission of the type_infos by the real toolchain is much better than
    second guessing and reverse engineering its operation.
    
    An even better approach would be to have the ucb throw the exceptions itself
    instead of wrapping, rewrapping, unwrapping, etc. them. Once this is done
    the dummyThrower helper function is no longer needed.

diff --git a/ucb/source/ucp/webdav/webdavcontent.cxx b/ucb/source/ucp/webdav/webdavcontent.cxx
index df558f0..0a41808 100644
--- a/ucb/source/ucp/webdav/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav/webdavcontent.cxx
@@ -3352,6 +3352,23 @@ uno::Any Content::MapDAVException( const DAVException & e, sal_Bool bWrite )
     return aException;
 }
 
+// #i124421# force the availability of type_info symbols for exceptions
+// that used to be passed around in uno::Any variables and thrown later
+void ucb_dummyThrower( int i) {
+    switch( i) {
+        case 10: throw ucb::InteractiveNetworkGeneralException();
+        case 11: throw ucb::InteractiveAugmentedIOException();
+        case 12: throw ucb::InteractiveNetworkGeneralException();
+        case 13: throw ucb::InteractiveNetworkWriteException();
+        case 14: throw ucb::InteractiveNetworkReadException();
+        case 15: throw ucb::InteractiveNetworkConnectException();
+        case 16: throw ucb::InteractiveLockingLockedException();
+        case 17: throw ucb::InteractiveLockingNotLockedException();
+        case 18: throw ucb::InteractiveNetworkGeneralException();
+        case 19: throw ucb::InteractiveLockingLockExpiredException();
+    }
+}
+
 //=========================================================================
 // static
 bool Content::shouldAccessNetworkAfterException( const DAVException & e )
commit 184348f1a82bc70ebf510b03a2ef0537d1cea278
Author: Herbert Dürr <hdu at apache.org>
Date:   Thu Mar 27 15:41:06 2014 +0000

    #i124421# disable generated type_info for the OSX64 uno bridge
    
    When the dynamic loading of the type_info symbols failed the UNO bridge
    synthesized type_info objects itself. The synthesized ones trigger the
    crash observed so we disable their generation and handle the result
    gracefully.

diff --git a/bridges/source/cpp_uno/s5abi_macosx_x86-64/except.cxx b/bridges/source/cpp_uno/s5abi_macosx_x86-64/except.cxx
index 96a65fc..baef65f 100644
--- a/bridges/source/cpp_uno/s5abi_macosx_x86-64/except.cxx
+++ b/bridges/source/cpp_uno/s5abi_macosx_x86-64/except.cxx
@@ -39,6 +39,7 @@
 #include <rtl/ustrbuf.hxx>
 #include <osl/diagnose.h>
 #include <osl/mutex.hxx>
+#include <tools/debug.hxx>
 
 #include <com/sun/star/uno/genfunc.hxx>
 #include "com/sun/star/uno/RuntimeException.hpp"
@@ -174,9 +175,15 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR
                 // symbol and rtti-name is nearly identical,
                 // the symbol is prefixed with _ZTI
                 char const * rttiName = symName.getStr() +4;
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL >= 1
                 fprintf( stderr,"generated rtti for %s\n", rttiName );
+                const OString aCUnoName = OUStringToOString( unoName, RTL_TEXTENCODING_UTF8);
+                DBG_WARNING1( "TypeInfo for \"%s\" not found and cannot be generated.\n", aCUnoName.getStr());
 #endif
+#if 0 // TODO: enable it again when the generated class_type_infos always work.
+      // Forcing the toolchain to create authentic typeinfos is much better though
+      // than the sick concept of reverse-engineering the platform's toolchain
+      // and generating the missing type_infos.
                 if (pTypeDescr->pBaseTypeDescription)
                 {
                     // ensure availability of base
@@ -190,10 +197,12 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR
                     // this class has no base class
                     rtti = new __class_type_info( strdup( rttiName ) );
                 }
+#else
+                rtti = NULL;
+#endif
 
-                pair< t_rtti_map::iterator, bool > insertion(
-                    m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti ) ) );
-                OSL_ENSURE( insertion.second, "### inserting new generated rtti failed?!" );
+                bool bOK = m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti )).second;
+                OSL_ENSURE( bOK, "### inserting new generated rtti failed?!" );
             }
             else // taking already generated rtti
             {
@@ -213,6 +222,8 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR
 static void deleteException( void * pExc )
 {
     __cxa_exception const * header = ((__cxa_exception const *)pExc - 1);
+    if( !header->exceptionType) // TODO: remove this when getRTTI() always returns non-NULL
+        return; // NOTE: leak for now
     typelib_TypeDescription * pTD = 0;
     OUString unoName( toUNOname( header->exceptionType->name() ) );
     ::typelib_typedescription_getByName( &pTD, unoName.pData );
diff --git a/bridges/source/cpp_uno/s5abi_macosx_x86-64/share.hxx b/bridges/source/cpp_uno/s5abi_macosx_x86-64/share.hxx
index 279b275..5b29f13 100644
--- a/bridges/source/cpp_uno/s5abi_macosx_x86-64/share.hxx
+++ b/bridges/source/cpp_uno/s5abi_macosx_x86-64/share.hxx
@@ -85,6 +85,8 @@ extern "C" __cxa_eh_globals *__cxa_get_globals () throw();
 
 // -----
 
+#if 0 // #i124421# disabled because its use in except.cxx is disabled
+
 // on OSX 64bit the class_type_info classes are specified
 // in http://refspecs.linuxbase.org/cxxabi-1.86.html#rtti but
 // these details are not generally available in a public header
@@ -106,6 +108,8 @@ public:
         {}
 };
 
+#endif
+
 //==================================================================================================
 void raiseException(
     uno_Any * pUnoExc, uno_Mapping * pUno2Cpp );


More information about the Libreoffice-commits mailing list