diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-20 15:02:10 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-23 07:56:34 +0200 |
commit | bbd8c94967a4d227be46c1e777efd5b4bcf95429 (patch) | |
tree | a19ced7bbc9afb4b6b80ec86fc6f95c85efacf79 /stoc | |
parent | ca958f886c660ce096ef59cef808fbf46b116e3c (diff) |
use rtl::Reference in stoc
instead of manual acquire/release
Change-Id: I626ad9875528fa76d8f781b07cc86e149032ecb1
Diffstat (limited to 'stoc')
-rw-r--r-- | stoc/source/corereflection/base.hxx | 11 | ||||
-rw-r--r-- | stoc/source/corereflection/crbase.cxx | 11 |
2 files changed, 10 insertions, 12 deletions
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 <cppuhelper/component.hxx> #include <cppuhelper/typeprovider.hxx> #include <rtl/ustring.hxx> +#include <rtl/ref.hxx> #include "lrucache.hxx" @@ -143,7 +144,8 @@ public: class IdlClassImpl : public ::cppu::WeakImplHelper< css::reflection::XIdlClass > { - IdlReflectionServiceImpl * _pReflection; + rtl::Reference<IdlReflectionServiceImpl> + 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<IdlReflectionServiceImpl> + 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 |