sb140: #i117295# use rtl::Static

This commit is contained in:
Stephan Bergmann
2011-09-09 17:31:07 +02:00
parent afe7061d8b
commit d3794d2d8a
24 changed files with 95 additions and 374 deletions

View File

@@ -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)