summaryrefslogtreecommitdiff
path: root/cppu/source
diff options
context:
space:
mode:
Diffstat (limited to 'cppu/source')
-rw-r--r--cppu/source/uno/data.cxx29
1 files changed, 13 insertions, 16 deletions
diff --git a/cppu/source/uno/data.cxx b/cppu/source/uno/data.cxx
index 68d114dc940f..6c93fced581d 100644
--- a/cppu/source/uno/data.cxx
+++ b/cppu/source/uno/data.cxx
@@ -44,22 +44,19 @@ typelib_TypeDescriptionReference * g_pVoidType = nullptr;
void * binuno_queryInterface( void * pUnoI, typelib_TypeDescriptionReference * pDestType )
{
// init queryInterface() td
- static typelib_TypeDescription * g_pQITD = nullptr;
- if (nullptr == g_pQITD)
- {
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- if (nullptr == g_pQITD)
- {
- typelib_TypeDescriptionReference * type_XInterface =
- * typelib_static_type_getByTypeClass( typelib_TypeClass_INTERFACE );
- typelib_InterfaceTypeDescription * pTXInterfaceDescr = nullptr;
- TYPELIB_DANGER_GET( reinterpret_cast<typelib_TypeDescription **>(&pTXInterfaceDescr), type_XInterface );
- assert(pTXInterfaceDescr->ppAllMembers);
- typelib_typedescriptionreference_getDescription(
- &g_pQITD, pTXInterfaceDescr->ppAllMembers[ 0 ] );
- TYPELIB_DANGER_RELEASE( &pTXInterfaceDescr->aBase );
- }
- }
+ static typelib_TypeDescription* g_pQITD = []() {
+ typelib_TypeDescriptionReference* type_XInterface
+ = *typelib_static_type_getByTypeClass(typelib_TypeClass_INTERFACE);
+ typelib_InterfaceTypeDescription* pTXInterfaceDescr = nullptr;
+ TYPELIB_DANGER_GET(reinterpret_cast<typelib_TypeDescription**>(&pTXInterfaceDescr),
+ type_XInterface);
+ assert(pTXInterfaceDescr->ppAllMembers);
+ typelib_TypeDescription* pQITD = nullptr;
+ typelib_typedescriptionreference_getDescription(&pQITD,
+ pTXInterfaceDescr->ppAllMembers[0]);
+ TYPELIB_DANGER_RELEASE(&pTXInterfaceDescr->aBase);
+ return pQITD;
+ }();
uno_Any aRet, aExc;
uno_Any * pExc = &aExc;