From bbd8c94967a4d227be46c1e777efd5b4bcf95429 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 20 Jan 2017 15:02:10 +0200 Subject: use rtl::Reference in stoc instead of manual acquire/release Change-Id: I626ad9875528fa76d8f781b07cc86e149032ecb1 --- stoc/source/corereflection/base.hxx | 11 +++++++---- stoc/source/corereflection/crbase.cxx | 11 +++-------- 2 files changed, 10 insertions(+), 12 deletions(-) (limited to 'stoc/source/corereflection') diff --git a/stoc/source/corereflection/base.hxx b/stoc/source/corereflection/base.hxx index 79d5592328e7..5f4676e192fb 100644 --- a/stoc/source/corereflection/base.hxx +++ b/stoc/source/corereflection/base.hxx @@ -34,6 +34,7 @@ #include #include #include +#include #include "lrucache.hxx" @@ -143,7 +144,8 @@ public: class IdlClassImpl : public ::cppu::WeakImplHelper< css::reflection::XIdlClass > { - IdlReflectionServiceImpl * _pReflection; + rtl::Reference + m_xReflection; OUString _aName; css::uno::TypeClass _eTypeClass; @@ -154,7 +156,7 @@ public: typelib_TypeDescription * getTypeDescr() const { return _pTypeDescr; } IdlReflectionServiceImpl * getReflection() const - { return _pReflection; } + { return m_xReflection.get(); } // Ctor IdlClassImpl( IdlReflectionServiceImpl * pReflection, @@ -327,7 +329,8 @@ public: class IdlMemberImpl : public ::cppu::WeakImplHelper< css::reflection::XIdlMember > { - IdlReflectionServiceImpl * _pReflection; + rtl::Reference + m_xReflection; OUString _aName; typelib_TypeDescription * _pTypeDescr; @@ -338,7 +341,7 @@ protected: public: IdlReflectionServiceImpl * getReflection() const - { return _pReflection; } + { return m_xReflection.get(); } typelib_TypeDescription * getTypeDescr() const { return _pTypeDescr; } typelib_TypeDescription * getDeclTypeDescr() const diff --git a/stoc/source/corereflection/crbase.cxx b/stoc/source/corereflection/crbase.cxx index aa8fdede7540..a1deec9b9368 100644 --- a/stoc/source/corereflection/crbase.cxx +++ b/stoc/source/corereflection/crbase.cxx @@ -52,13 +52,11 @@ ClassNameList g_aClassNames; IdlClassImpl::IdlClassImpl( IdlReflectionServiceImpl * pReflection, const OUString & rName, typelib_TypeClass eTypeClass, typelib_TypeDescription * pTypeDescr ) - : _pReflection( pReflection ) + : m_xReflection( pReflection ) , _aName( rName ) , _eTypeClass( (TypeClass)eTypeClass ) , _pTypeDescr( pTypeDescr ) { - if (_pReflection) - _pReflection->acquire(); if (_pTypeDescr) { typelib_typedescription_acquire( _pTypeDescr ); @@ -77,8 +75,7 @@ IdlClassImpl::~IdlClassImpl() { if (_pTypeDescr) typelib_typedescription_release( _pTypeDescr ); - if (_pReflection) - _pReflection->release(); + m_xReflection.clear(); #ifdef TEST_LIST_CLASSES ClassNameList::iterator iFind( std::find( g_aClassNames.begin(), g_aClassNames.end(), _aName ) ); @@ -231,12 +228,11 @@ Reference< XIdlArray > IdlClassImpl::getArray() IdlMemberImpl::IdlMemberImpl( IdlReflectionServiceImpl * pReflection, const OUString & rName, typelib_TypeDescription * pTypeDescr, typelib_TypeDescription * pDeclTypeDescr ) - : _pReflection( pReflection ) + : m_xReflection( pReflection ) , _aName( rName ) , _pTypeDescr( pTypeDescr ) , _pDeclTypeDescr( pDeclTypeDescr ) { - _pReflection->acquire(); typelib_typedescription_acquire( _pTypeDescr ); if (! _pTypeDescr->bComplete) typelib_typedescription_complete( &_pTypeDescr ); @@ -249,7 +245,6 @@ IdlMemberImpl::~IdlMemberImpl() { typelib_typedescription_release( _pDeclTypeDescr ); typelib_typedescription_release( _pTypeDescr ); - _pReflection->release(); } // XIdlMember -- cgit