diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx index 046063a0a2ae..716e35c95df1 100644 --- a/stoc/source/inspect/introspection.cxx +++ b/stoc/source/inspect/introspection.cxx @@ -685,8 +685,8 @@ class ImplIntrospectionAccess : public IntrospectionAccessHelper Reference getXEnumerationAccess(); Reference getXIdlArray(); - void cacheXNameContainer(); - void cacheXIndexContainer(); + void cacheXNameContainer(const std::unique_lock& rGuard); + void cacheXIndexContainer(const std::unique_lock& rGuard); public: ImplIntrospectionAccess( Any obj, rtl::Reference< IntrospectionAccessStatic_Impl > pStaticImpl_ ); @@ -797,7 +797,7 @@ Reference ImplIntrospectionAccess::getXElementAccess() return mxObjElementAccess; } -void ImplIntrospectionAccess::cacheXNameContainer() +void ImplIntrospectionAccess::cacheXNameContainer(const std::unique_lock& /*rGuard*/) { Reference xNameContainer; Reference xNameReplace; @@ -819,7 +819,6 @@ void ImplIntrospectionAccess::cacheXNameContainer() } { - std::unique_lock aGuard( m_aMutex ); if( !mxObjNameContainer.is() ) mxObjNameContainer = xNameContainer; if( !mxObjNameReplace.is() ) @@ -834,10 +833,8 @@ Reference ImplIntrospectionAccess::getXNameContainer() std::unique_lock aGuard( m_aMutex ); if( !mxObjNameContainer.is() ) - { - aGuard.unlock(); - cacheXNameContainer(); - } + cacheXNameContainer(aGuard); + return mxObjNameContainer; } @@ -846,10 +843,8 @@ Reference ImplIntrospectionAccess::getXNameReplace() std::unique_lock aGuard( m_aMutex ); if( !mxObjNameReplace.is() ) - { - aGuard.unlock(); - cacheXNameContainer(); - } + cacheXNameContainer(aGuard); + return mxObjNameReplace; } @@ -858,14 +853,12 @@ Reference ImplIntrospectionAccess::getXNameAccess() std::unique_lock aGuard( m_aMutex ); if( !mxObjNameAccess.is() ) - { - aGuard.unlock(); - cacheXNameContainer(); - } + cacheXNameContainer(aGuard); + return mxObjNameAccess; } -void ImplIntrospectionAccess::cacheXIndexContainer() +void ImplIntrospectionAccess::cacheXIndexContainer(const std::unique_lock& /*rGuard*/) { Reference xIndexContainer; Reference xIndexReplace; @@ -887,7 +880,6 @@ void ImplIntrospectionAccess::cacheXIndexContainer() } { - std::unique_lock aGuard( m_aMutex ); if( !mxObjIndexContainer.is() ) mxObjIndexContainer = xIndexContainer; if( !mxObjIndexReplace.is() ) @@ -902,10 +894,8 @@ Reference ImplIntrospectionAccess::getXIndexContainer() std::unique_lock aGuard( m_aMutex ); if( !mxObjIndexContainer.is() ) - { - aGuard.unlock(); - cacheXIndexContainer(); - } + cacheXIndexContainer(aGuard); + return mxObjIndexContainer; } @@ -914,10 +904,8 @@ Reference ImplIntrospectionAccess::getXIndexReplace() std::unique_lock aGuard( m_aMutex ); if( !mxObjIndexReplace.is() ) - { - aGuard.unlock(); - cacheXIndexContainer(); - } + cacheXIndexContainer(aGuard); + return mxObjIndexReplace; } @@ -926,10 +914,8 @@ Reference ImplIntrospectionAccess::getXIndexAccess() std::unique_lock aGuard( m_aMutex ); if( !mxObjIndexAccess.is() ) - { - aGuard.unlock(); - cacheXIndexContainer(); - } + cacheXIndexContainer(aGuard); + return mxObjIndexAccess; }