diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2011-09-09 17:31:07 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2011-09-09 17:46:39 +0200 |
commit | d3794d2d8ab2ee3f8118d61538bb753335b37f23 (patch) | |
tree | 6c5c0ab6baca8759474790cea1475c8dae2cb1b7 /bridges | |
parent | afe7061d8ba46629f610991b5d35f5e0668fcf89 (diff) |
sb140: #i117295# use rtl::Static
Diffstat (limited to 'bridges')
24 files changed, 95 insertions, 374 deletions
diff --git a/bridges/source/cpp_uno/cc50_solaris_intel/except.cxx b/bridges/source/cpp_uno/cc50_solaris_intel/except.cxx index 6a9b923a4e26..061c3742df03 100644 --- a/bridges/source/cpp_uno/cc50_solaris_intel/except.cxx +++ b/bridges/source/cpp_uno/cc50_solaris_intel/except.cxx @@ -36,6 +36,7 @@ #include <list> #include <map> #include <rtl/alloc.h> +#include <rtl/instance.hxx> #include <osl/diagnose.h> #include <rtl/strbuf.hxx> @@ -313,6 +314,8 @@ void* RTTIHolder::generateRTTI( typelib_CompoundTypeDescription * pCompTypeDescr return pRTTI; } +struct RTTISingleton: public rtl::Static< RTTIHolder, RTTISingleton > {}; + //__________________________________________________________________________________________________ static void deleteException( @@ -345,23 +348,7 @@ void cc50_solaris_intel_raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cp // will be released by deleteException typelib_typedescriptionreference_getDescription( &pTypeDescr, pUnoExc->pType ); - void* pRTTI; - { - static ::osl::Mutex aMutex; - ::osl::Guard< ::osl::Mutex > guard( aMutex ); - - static RTTIHolder * s_pRTTI = 0; - if (! s_pRTTI) - { -#ifdef LEAK_STATIC_DATA - s_pRTTI = new RTTIHolder(); -#else - static RTTIHolder s_aRTTI; - s_pRTTI = &s_aRTTI; -#endif - } - - pRTTI = s_pRTTI->generateRTTI( (typelib_CompoundTypeDescription *)pTypeDescr ); + pRTTI = RTTISingleton::get().generateRTTI( (typelib_CompoundTypeDescription *)pTypeDescr ); } // a must be diff --git a/bridges/source/cpp_uno/cc50_solaris_sparc/except.cxx b/bridges/source/cpp_uno/cc50_solaris_sparc/except.cxx index 84ce64ee1841..6759d798e1c2 100644 --- a/bridges/source/cpp_uno/cc50_solaris_sparc/except.cxx +++ b/bridges/source/cpp_uno/cc50_solaris_sparc/except.cxx @@ -36,6 +36,7 @@ #include <list> #include <map> #include <rtl/alloc.h> +#include <rtl/instance.hxx> #include <osl/diagnose.h> #include <typelib/typedescription.hxx> #include <com/sun/star/uno/Any.hxx> @@ -315,6 +316,8 @@ void* RTTIHolder::generateRTTI( typelib_CompoundTypeDescription * pCompTypeDescr return pRTTI; } +struct RTTISingleton: public rtl::Static< RTTIHolder, RTTISingleton > {}; + //-------------------------------------------------------------------------------------------------- static void deleteException( @@ -348,23 +351,7 @@ void cc50_solaris_sparc_raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cp // will be released by deleteException typelib_typedescriptionreference_getDescription( &pTypeDescr, pUnoExc->pType ); - void* pRTTI; - { - static ::osl::Mutex aMutex; - ::osl::Guard< ::osl::Mutex > guard( aMutex ); - - static RTTIHolder * s_pRTTI = 0; - if (! s_pRTTI) - { -#ifdef LEAK_STATIC_DATA - s_pRTTI = new RTTIHolder(); -#else - static RTTIHolder s_aRTTI; - s_pRTTI = &s_aRTTI; -#endif - } - - pRTTI = s_pRTTI->generateRTTI( (typelib_CompoundTypeDescription *)pTypeDescr ); + pRTTI = RTTISingleton::get().generateRTTI( (typelib_CompoundTypeDescription *)pTypeDescr ); } // a must be diff --git a/bridges/source/cpp_uno/gcc3_aix_powerpc/except.cxx b/bridges/source/cpp_uno/gcc3_aix_powerpc/except.cxx index 2086ef7e7bba..6ce9103160ba 100644 --- a/bridges/source/cpp_uno/gcc3_aix_powerpc/except.cxx +++ b/bridges/source/cpp_uno/gcc3_aix_powerpc/except.cxx @@ -34,6 +34,7 @@ #include <cxxabi.h> #include <boost/unordered_map.hpp> +#include <rtl/instance.hxx> #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> #include <osl/diagnose.h> @@ -205,6 +206,8 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR return rtti; } +struct RTTISingleton: public rtl::Static< RTTI, RTTISingleton > {}; + //-------------------------------------------------------------------------------------------------- static void deleteException( void * pExc ) { @@ -240,21 +243,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // destruct uno exception ::uno_any_destruct( pUnoExc, 0 ); // avoiding locked counts - static RTTI * s_rtti = 0; - if (! s_rtti) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if (! s_rtti) - { -#ifdef LEAK_STATIC_DATA - s_rtti = new RTTI(); -#else - static RTTI rtti_data; - s_rtti = &rtti_data; -#endif - } - } - rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); + rtti = (type_info *)RTTISingleton::get().getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); if (! rtti) diff --git a/bridges/source/cpp_uno/gcc3_ios_arm/except.cxx b/bridges/source/cpp_uno/gcc3_ios_arm/except.cxx index a14bc8b9aec0..b2f8c0333332 100644 --- a/bridges/source/cpp_uno/gcc3_ios_arm/except.cxx +++ b/bridges/source/cpp_uno/gcc3_ios_arm/except.cxx @@ -34,6 +34,7 @@ #include <cxxabi.h> #include <boost/unordered_map.hpp> +#include <rtl/instance.hxx> #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> #include <osl/diagnose.h> @@ -206,6 +207,8 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR return rtti; } +struct RTTISingleton: public rtl::Static< RTTI, RTTISingleton > {}; + //-------------------------------------------------------------------------------------------------- static void deleteException( void * pExc ) { @@ -253,21 +256,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // destruct uno exception ::uno_any_destruct( pUnoExc, 0 ); // avoiding locked counts - static RTTI * s_rtti = 0; - if (! s_rtti) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if (! s_rtti) - { -#ifdef LEAK_STATIC_DATA - s_rtti = new RTTI(); -#else - static RTTI rtti_data; - s_rtti = &rtti_data; -#endif - } - } - rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); + rtti = (type_info *)RTTISingleton::get().getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); if (! rtti) diff --git a/bridges/source/cpp_uno/gcc3_linux_alpha/except.cxx b/bridges/source/cpp_uno/gcc3_linux_alpha/except.cxx index ea4188bac998..337ceff5b9eb 100644 --- a/bridges/source/cpp_uno/gcc3_linux_alpha/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_alpha/except.cxx @@ -35,6 +35,7 @@ #include <cxxabi.h> #include <boost/unordered_map.hpp> +#include <rtl/instance.hxx> #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> #include <osl/diagnose.h> @@ -206,6 +207,8 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR return rtti; } +struct RTTISingleton: public rtl::Static< RTTI, RTTISingleton > {}; + //-------------------------------------------------------------------------------------------------- static void deleteException( void * pExc ) { @@ -240,22 +243,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // destruct uno exception ::uno_any_destruct( pUnoExc, 0 ); - // avoiding locked counts - static RTTI * s_rtti = 0; - if (! s_rtti) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if (! s_rtti) - { -#ifdef LEAK_STATIC_DATA - s_rtti = new RTTI(); -#else - static RTTI rtti_data; - s_rtti = &rtti_data; -#endif - } - } - rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); + rtti = (type_info *)RTTISingleton::get().getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); if (! rtti) diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/except.cxx b/bridges/source/cpp_uno/gcc3_linux_arm/except.cxx index d8452d8db027..230d86fe3396 100644 --- a/bridges/source/cpp_uno/gcc3_linux_arm/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_arm/except.cxx @@ -32,6 +32,7 @@ #include <cxxabi.h> #include <boost/unordered_map.hpp> +#include <rtl/instance.hxx> #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> #include <osl/diagnose.h> @@ -205,6 +206,8 @@ namespace CPPU_CURRENT_NAMESPACE return rtti; } + struct RTTISingleton: public rtl::Static< RTTI, RTTISingleton > {}; + //------------------------------------------------------------------ static void deleteException( void * pExc ) { @@ -251,22 +254,7 @@ namespace CPPU_CURRENT_NAMESPACE // destruct uno exception ::uno_any_destruct( pUnoExc, 0 ); - // avoiding locked counts - static RTTI * s_rtti = 0; - if (! s_rtti) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if (! s_rtti) - { -#ifdef LEAK_STATIC_DATA - s_rtti = new RTTI(); -#else - static RTTI rtti_data; - s_rtti = &rtti_data; -#endif - } - } - rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); + rtti = (type_info *)RTTISingleton::get().getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); if (! rtti) diff --git a/bridges/source/cpp_uno/gcc3_linux_hppa/except.cxx b/bridges/source/cpp_uno/gcc3_linux_hppa/except.cxx index 1128f0f85cd8..84c642e147a4 100644 --- a/bridges/source/cpp_uno/gcc3_linux_hppa/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_hppa/except.cxx @@ -32,6 +32,7 @@ #include <cxxabi.h> #include <boost/unordered_map.hpp> +#include <rtl/instance.hxx> #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> #include <osl/diagnose.h> @@ -205,6 +206,8 @@ namespace CPPU_CURRENT_NAMESPACE return rtti; } + struct RTTISingleton: public rtl::Static< RTTI, RTTISingleton > {}; + //------------------------------------------------------------------ static void deleteException( void * pExc ) { @@ -251,22 +254,7 @@ namespace CPPU_CURRENT_NAMESPACE // destruct uno exception ::uno_any_destruct( pUnoExc, 0 ); - // avoiding locked counts - static RTTI * s_rtti = 0; - if (! s_rtti) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if (! s_rtti) - { -#ifdef LEAK_STATIC_DATA - s_rtti = new RTTI(); -#else - static RTTI rtti_data; - s_rtti = &rtti_data; -#endif - } - } - rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); + rtti = (type_info *)RTTISingleton::get().getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); if (! rtti) diff --git a/bridges/source/cpp_uno/gcc3_linux_ia64/except.cxx b/bridges/source/cpp_uno/gcc3_linux_ia64/except.cxx index ea4188bac998..64d45489de44 100644 --- a/bridges/source/cpp_uno/gcc3_linux_ia64/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_ia64/except.cxx @@ -35,6 +35,7 @@ #include <cxxabi.h> #include <boost/unordered_map.hpp> +#include <rtl/instance.hxx> #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> #include <osl/diagnose.h> @@ -206,6 +207,8 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR return rtti; } +struct RTTISingleton: public rtl::Static< RTTI, RTTISingleton > {}; + //-------------------------------------------------------------------------------------------------- static void deleteException( void * pExc ) { @@ -240,22 +243,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // destruct uno exception ::uno_any_destruct( pUnoExc, 0 ); - // avoiding locked counts - static RTTI * s_rtti = 0; - if (! s_rtti) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if (! s_rtti) - { -#ifdef LEAK_STATIC_DATA - s_rtti = new RTTI(); -#else - static RTTI rtti_data; - s_rtti = &rtti_data; -#endif - } - } - rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); + rtti = (type_info *)RTTISingleton::get().getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); if (! rtti) diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx b/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx index 02ac42b1d4e7..155640d313c3 100644 --- a/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx @@ -36,6 +36,7 @@ #include <cxxabi.h> +#include <rtl/instance.hxx> #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> #include <osl/diagnose.h> @@ -215,6 +216,8 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR return rtti; } +struct RTTISingleton: public rtl::Static< RTTI, RTTISingleton > {}; + //-------------------------------------------------------------------------------------------------- static void deleteException( void * pExc ) { @@ -261,22 +264,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // destruct uno exception ::uno_any_destruct( pUnoExc, 0 ); - // avoiding locked counts - static RTTI * s_rtti = 0; - if (! s_rtti) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if (! s_rtti) - { -#ifdef LEAK_STATIC_DATA - s_rtti = new RTTI(); -#else - static RTTI rtti_data; - s_rtti = &rtti_data; -#endif - } - } - rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); + rtti = (type_info *)RTTISingleton::get().getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); if (! rtti) diff --git a/bridges/source/cpp_uno/gcc3_linux_m68k/except.cxx b/bridges/source/cpp_uno/gcc3_linux_m68k/except.cxx index 1128f0f85cd8..84c642e147a4 100644 --- a/bridges/source/cpp_uno/gcc3_linux_m68k/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_m68k/except.cxx @@ -32,6 +32,7 @@ #include <cxxabi.h> #include <boost/unordered_map.hpp> +#include <rtl/instance.hxx> #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> #include <osl/diagnose.h> @@ -205,6 +206,8 @@ namespace CPPU_CURRENT_NAMESPACE return rtti; } + struct RTTISingleton: public rtl::Static< RTTI, RTTISingleton > {}; + //------------------------------------------------------------------ static void deleteException( void * pExc ) { @@ -251,22 +254,7 @@ namespace CPPU_CURRENT_NAMESPACE // destruct uno exception ::uno_any_destruct( pUnoExc, 0 ); - // avoiding locked counts - static RTTI * s_rtti = 0; - if (! s_rtti) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if (! s_rtti) - { -#ifdef LEAK_STATIC_DATA - s_rtti = new RTTI(); -#else - static RTTI rtti_data; - s_rtti = &rtti_data; -#endif - } - } - rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); + rtti = (type_info *)RTTISingleton::get().getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); if (! rtti) diff --git a/bridges/source/cpp_uno/gcc3_linux_mips/except.cxx b/bridges/source/cpp_uno/gcc3_linux_mips/except.cxx index f4c4e24c4374..804433d565aa 100644 --- a/bridges/source/cpp_uno/gcc3_linux_mips/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_mips/except.cxx @@ -31,6 +31,7 @@ #include <cxxabi.h> #include <boost/unordered_map.hpp> +#include <rtl/instance.hxx> #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> #include <osl/diagnose.h> @@ -202,6 +203,8 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR return rtti; } +struct RTTISingleton: public rtl::Static< RTTI, RTTISingleton > {}; + //-------------------------------------------------------------------------------------------------- static void deleteException( void * pExc ) { @@ -248,22 +251,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // destruct uno exception ::uno_any_destruct( pUnoExc, 0 ); - // avoiding locked counts - static RTTI * s_rtti = 0; - if (! s_rtti) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if (! s_rtti) - { -#ifdef LEAK_STATIC_DATA - s_rtti = new RTTI(); -#else - static RTTI rtti_data; - s_rtti = &rtti_data; -#endif - } - } - rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); + rtti = (type_info *)RTTISingleton::get().getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); if (! rtti) diff --git a/bridges/source/cpp_uno/gcc3_linux_powerpc/except.cxx b/bridges/source/cpp_uno/gcc3_linux_powerpc/except.cxx index ea4188bac998..64d45489de44 100644 --- a/bridges/source/cpp_uno/gcc3_linux_powerpc/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_powerpc/except.cxx @@ -35,6 +35,7 @@ #include <cxxabi.h> #include <boost/unordered_map.hpp> +#include <rtl/instance.hxx> #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> #include <osl/diagnose.h> @@ -206,6 +207,8 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR return rtti; } +struct RTTISingleton: public rtl::Static< RTTI, RTTISingleton > {}; + //-------------------------------------------------------------------------------------------------- static void deleteException( void * pExc ) { @@ -240,22 +243,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // destruct uno exception ::uno_any_destruct( pUnoExc, 0 ); - // avoiding locked counts - static RTTI * s_rtti = 0; - if (! s_rtti) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if (! s_rtti) - { -#ifdef LEAK_STATIC_DATA - s_rtti = new RTTI(); -#else - static RTTI rtti_data; - s_rtti = &rtti_data; -#endif - } - } - rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); + rtti = (type_info *)RTTISingleton::get().getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); if (! rtti) diff --git a/bridges/source/cpp_uno/gcc3_linux_powerpc64/except.cxx b/bridges/source/cpp_uno/gcc3_linux_powerpc64/except.cxx index ea4188bac998..64d45489de44 100644 --- a/bridges/source/cpp_uno/gcc3_linux_powerpc64/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_powerpc64/except.cxx @@ -35,6 +35,7 @@ #include <cxxabi.h> #include <boost/unordered_map.hpp> +#include <rtl/instance.hxx> #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> #include <osl/diagnose.h> @@ -206,6 +207,8 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR return rtti; } +struct RTTISingleton: public rtl::Static< RTTI, RTTISingleton > {}; + //-------------------------------------------------------------------------------------------------- static void deleteException( void * pExc ) { @@ -240,22 +243,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // destruct uno exception ::uno_any_destruct( pUnoExc, 0 ); - // avoiding locked counts - static RTTI * s_rtti = 0; - if (! s_rtti) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if (! s_rtti) - { -#ifdef LEAK_STATIC_DATA - s_rtti = new RTTI(); -#else - static RTTI rtti_data; - s_rtti = &rtti_data; -#endif - } - } - rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); + rtti = (type_info *)RTTISingleton::get().getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); if (! rtti) diff --git a/bridges/source/cpp_uno/gcc3_linux_s390/except.cxx b/bridges/source/cpp_uno/gcc3_linux_s390/except.cxx index ea4188bac998..64d45489de44 100644 --- a/bridges/source/cpp_uno/gcc3_linux_s390/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_s390/except.cxx @@ -35,6 +35,7 @@ #include <cxxabi.h> #include <boost/unordered_map.hpp> +#include <rtl/instance.hxx> #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> #include <osl/diagnose.h> @@ -206,6 +207,8 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR return rtti; } +struct RTTISingleton: public rtl::Static< RTTI, RTTISingleton > {}; + //-------------------------------------------------------------------------------------------------- static void deleteException( void * pExc ) { @@ -240,22 +243,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // destruct uno exception ::uno_any_destruct( pUnoExc, 0 ); - // avoiding locked counts - static RTTI * s_rtti = 0; - if (! s_rtti) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if (! s_rtti) - { -#ifdef LEAK_STATIC_DATA - s_rtti = new RTTI(); -#else - static RTTI rtti_data; - s_rtti = &rtti_data; -#endif - } - } - rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); + rtti = (type_info *)RTTISingleton::get().getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); if (! rtti) diff --git a/bridges/source/cpp_uno/gcc3_linux_s390x/except.cxx b/bridges/source/cpp_uno/gcc3_linux_s390x/except.cxx index ea4188bac998..337ceff5b9eb 100644 --- a/bridges/source/cpp_uno/gcc3_linux_s390x/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_s390x/except.cxx @@ -35,6 +35,7 @@ #include <cxxabi.h> #include <boost/unordered_map.hpp> +#include <rtl/instance.hxx> #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> #include <osl/diagnose.h> @@ -206,6 +207,8 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR return rtti; } +struct RTTISingleton: public rtl::Static< RTTI, RTTISingleton > {}; + //-------------------------------------------------------------------------------------------------- static void deleteException( void * pExc ) { @@ -240,22 +243,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // destruct uno exception ::uno_any_destruct( pUnoExc, 0 ); - // avoiding locked counts - static RTTI * s_rtti = 0; - if (! s_rtti) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if (! s_rtti) - { -#ifdef LEAK_STATIC_DATA - s_rtti = new RTTI(); -#else - static RTTI rtti_data; - s_rtti = &rtti_data; -#endif - } - } - rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); + rtti = (type_info *)RTTISingleton::get().getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); if (! rtti) diff --git a/bridges/source/cpp_uno/gcc3_linux_sparc/except.cxx b/bridges/source/cpp_uno/gcc3_linux_sparc/except.cxx index f95848008920..da3df3479d62 100644 --- a/bridges/source/cpp_uno/gcc3_linux_sparc/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_sparc/except.cxx @@ -34,6 +34,7 @@ #include <cxxabi.h> #include <boost/unordered_map.hpp> +#include <rtl/instance.hxx> #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> #include <osl/diagnose.h> @@ -205,6 +206,8 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR return rtti; } +struct RTTISingleton: public rtl::Static< RTTI, RTTISingleton > {}; + //-------------------------------------------------------------------------------------------------- static void deleteException( void * pExc ) { @@ -251,22 +254,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // destruct uno exception ::uno_any_destruct( pUnoExc, 0 ); - // avoiding locked counts - static RTTI * s_rtti = 0; - if (! s_rtti) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if (! s_rtti) - { -#ifdef LEAK_STATIC_DATA - s_rtti = new RTTI(); -#else - static RTTI rtti_data; - s_rtti = &rtti_data; -#endif - } - } - rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); + rtti = (type_info *)RTTISingleton::get().getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); if (! rtti) diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx index 74b2b7311509..b22335f0f18d 100644 --- a/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx @@ -35,9 +35,9 @@ #include <cxxabi.h> #include <boost/unordered_map.hpp> +#include <rtl/instance.hxx> #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> -#include <rtl/instance.hxx> #include <osl/diagnose.h> #include <osl/mutex.hxx> @@ -216,6 +216,8 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR return rtti; } +struct RTTISingleton: public rtl::Static< RTTI, RTTISingleton > {}; + //-------------------------------------------------------------------------------------------------- static void deleteException( void * pExc ) { @@ -231,11 +233,6 @@ static void deleteException( void * pExc ) } } -namespace -{ - struct theRTTI : public rtl::Static<RTTI, theRTTI> {}; -} - //================================================================================================== void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) { @@ -268,8 +265,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // destruct uno exception ::uno_any_destruct( pUnoExc, 0 ); // avoiding locked counts - static RTTI &rRTTI = theRTTI::get(); - rtti = rRTTI.getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); + rtti = (type_info *)RTTISingleton::get().getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); if (! rtti) diff --git a/bridges/source/cpp_uno/gcc3_macosx_intel/except.cxx b/bridges/source/cpp_uno/gcc3_macosx_intel/except.cxx index a14bc8b9aec0..888e6f8d0519 100644 --- a/bridges/source/cpp_uno/gcc3_macosx_intel/except.cxx +++ b/bridges/source/cpp_uno/gcc3_macosx_intel/except.cxx @@ -34,6 +34,7 @@ #include <cxxabi.h> #include <boost/unordered_map.hpp> +#include <rtl/instance.hxx> #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> #include <osl/diagnose.h> @@ -206,6 +207,8 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR return rtti; } +struct RTTISingleton: public rtl::Static< RTTI, RTTISingleton > {}; + //-------------------------------------------------------------------------------------------------- static void deleteException( void * pExc ) { @@ -252,22 +255,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // destruct uno exception ::uno_any_destruct( pUnoExc, 0 ); - // avoiding locked counts - static RTTI * s_rtti = 0; - if (! s_rtti) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if (! s_rtti) - { -#ifdef LEAK_STATIC_DATA - s_rtti = new RTTI(); -#else - static RTTI rtti_data; - s_rtti = &rtti_data; -#endif - } - } - rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); + rtti = (type_info *)RTTISingleton::get().getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); if (! rtti) diff --git a/bridges/source/cpp_uno/gcc3_macosx_powerpc/except.cxx b/bridges/source/cpp_uno/gcc3_macosx_powerpc/except.cxx index 274f99987cb8..d8220ebec44a 100644 --- a/bridges/source/cpp_uno/gcc3_macosx_powerpc/except.cxx +++ b/bridges/source/cpp_uno/gcc3_macosx_powerpc/except.cxx @@ -34,6 +34,7 @@ #include <cxxabi.h> #include <boost/unordered_map.hpp> +#include <rtl/instance.hxx> #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> #include <osl/diagnose.h> @@ -205,6 +206,8 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR return rtti; } +struct RTTISingleton: public rtl::Static< RTTI, RTTISingleton > {}; + //-------------------------------------------------------------------------------------------------- static void deleteException( void * pExc ) { @@ -239,22 +242,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // destruct uno exception ::uno_any_destruct( pUnoExc, 0 ); - // avoiding locked counts - static RTTI * s_rtti = 0; - if (! s_rtti) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if (! s_rtti) - { -#ifdef LEAK_STATIC_DATA - s_rtti = new RTTI(); -#else - static RTTI rtti_data; - s_rtti = &rtti_data; -#endif - } - } - rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); + rtti = (type_info *)RTTISingleton::get().getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); if (! rtti) diff --git a/bridges/source/cpp_uno/gcc3_solaris_intel/except.cxx b/bridges/source/cpp_uno/gcc3_solaris_intel/except.cxx index 4779b145ab06..bd18ceb354b1 100644 --- a/bridges/source/cpp_uno/gcc3_solaris_intel/except.cxx +++ b/bridges/source/cpp_uno/gcc3_solaris_intel/except.cxx @@ -34,6 +34,7 @@ #include <cxxabi.h> #include <boost/unordered_map.hpp> +#include <rtl/instance.hxx> #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> #include <osl/diagnose.h> @@ -206,6 +207,8 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR return rtti; } +struct RTTISingleton: public rtl::Static< RTTI, RTTISingleton > {}; + //-------------------------------------------------------------------------------------------------- static void deleteException( void * pExc ) { @@ -252,22 +255,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // destruct uno exception ::uno_any_destruct( pUnoExc, 0 ); - // avoiding locked counts - static RTTI * s_rtti = 0; - if (! s_rtti) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if (! s_rtti) - { -#ifdef LEAK_STATIC_DATA - s_rtti = new RTTI(); -#else - static RTTI rtti_data; - s_rtti = &rtti_data; -#endif - } - } - rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); + rtti = (type_info *)RTTISingleton::get().getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); if (! rtti) diff --git a/bridges/source/cpp_uno/gcc3_solaris_sparc/except.cxx b/bridges/source/cpp_uno/gcc3_solaris_sparc/except.cxx index fef8c3facada..7e493d346907 100644 --- a/bridges/source/cpp_uno/gcc3_solaris_sparc/except.cxx +++ b/bridges/source/cpp_uno/gcc3_solaris_sparc/except.cxx @@ -33,6 +33,7 @@ #include <cxxabi.h> #include <boost/unordered_map.hpp> +#include <rtl/instance.hxx> #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> #include <osl/diagnose.h> @@ -204,6 +205,8 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR return rtti; } +struct RTTISingleton: public rtl::Static< RTTI, RTTISingleton > {}; + //-------------------------------------------------------------------------------------------------- static void deleteException( void * pExc ) { @@ -250,22 +253,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // destruct uno exception ::uno_any_destruct( pUnoExc, 0 ); - // avoiding locked counts - static RTTI * s_rtti = 0; - if (! s_rtti) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if (! s_rtti) - { -#ifdef LEAK_STATIC_DATA - s_rtti = new RTTI(); -#else - static RTTI rtti_data; - s_rtti = &rtti_data; -#endif - } - } - rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); + rtti = (type_info *)RTTISingleton::get().getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); if (! rtti) diff --git a/bridges/source/cpp_uno/mingw_intel/except.cxx b/bridges/source/cpp_uno/mingw_intel/except.cxx index 5997c3b1ea2a..13db595c689e 100644 --- a/bridges/source/cpp_uno/mingw_intel/except.cxx +++ b/bridges/source/cpp_uno/mingw_intel/except.cxx @@ -34,6 +34,7 @@ #include <cxxabi.h> #include <boost/unordered_map.hpp> +#include <rtl/instance.hxx> #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> #include <osl/diagnose.h> @@ -191,6 +192,8 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR return rtti; } +struct RTTISingleton: public rtl::Static< RTTI, RTTISingleton > {}; + //-------------------------------------------------------------------------------------------------- static void deleteException( void * pExc ) { @@ -237,22 +240,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // destruct uno exception ::uno_any_destruct( pUnoExc, 0 ); - // avoiding locked counts - static RTTI * s_rtti = 0; - if (! s_rtti) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if (! s_rtti) - { -#ifdef LEAK_STATIC_DATA - s_rtti = new RTTI(); -#else - static RTTI rtti_data; - s_rtti = &rtti_data; -#endif - } - } - rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); + rtti = (type_info *)RTTISingleton::get().getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); if (! rtti) diff --git a/bridges/source/cpp_uno/msvc_win32_intel/except.cxx b/bridges/source/cpp_uno/msvc_win32_intel/except.cxx index e8ac31ebf3a7..b1bbe0df8b42 100644 --- a/bridges/source/cpp_uno/msvc_win32_intel/except.cxx +++ b/bridges/source/cpp_uno/msvc_win32_intel/except.cxx @@ -38,6 +38,7 @@ #include <signal.h> #include "rtl/alloc.h" +#include <rtl/instance.hxx> #include "rtl/strbuf.hxx" #include "rtl/ustrbuf.hxx" @@ -185,6 +186,7 @@ RTTInfos::~RTTInfos() throw () } } +struct RTTISingleton: public rtl::Static< RTTInfos, RTTISingleton > {}; //################################################################################################## //#### Exception raising ########################################################################### @@ -455,21 +457,7 @@ void * ExceptionInfos::getRaiseInfo( typelib_TypeDescription * pTypeDescr ) thro //################################################################################################## type_info * msci_getRTTI( OUString const & rUNOname ) { - static RTTInfos * s_pRTTIs = 0; - if (! s_pRTTIs) - { - MutexGuard aGuard( Mutex::getGlobalMutex() ); - if (! s_pRTTIs) - { -#ifdef LEAK_STATIC_DATA - s_pRTTIs = new RTTInfos(); -#else - static RTTInfos s_aRTTIs; - s_pRTTIs = &s_aRTTIs; -#endif - } - } - return s_pRTTIs->getRTTI( rUNOname ); + return RTTISingleton::get().getRTTI( rUNOname ); } //################################################################################################## diff --git a/bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx b/bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx index 2157568ad915..ac0da414d402 100644 --- a/bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx +++ b/bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx @@ -254,6 +254,7 @@ void #include <signal.h> #include "rtl/alloc.h" +#include <rtl/instance.hxx> #include "rtl/strbuf.hxx" #include "rtl/ustrbuf.hxx" @@ -660,24 +661,12 @@ RaiseInfo * ExceptionInfos::getRaiseInfo( typelib_TypeDescription * pTD ) throw return pRaiseInfo; } +struct RTTISingleton: public rtl::Static< RTTInfos, RTTISingleton > {}; + type_info * mscx_getRTTI( OUString const & rUNOname ) { - static RTTInfos * s_pRTTIs = 0; - if (! s_pRTTIs) - { - MutexGuard aGuard( Mutex::getGlobalMutex() ); - if (! s_pRTTIs) - { -#ifdef LEAK_STATIC_DATA - s_pRTTIs = new RTTInfos(); -#else - static RTTInfos s_aRTTIs; - s_pRTTIs = &s_aRTTIs; -#endif - } - } - return s_pRTTIs->getRTTI( rUNOname ); + return RTTISingleton::get().getRTTI( rUNOname ); } void mscx_raiseException( |