diff options
author | Noel Grandin <noel@peralex.com> | 2016-05-23 13:53:42 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-05-24 06:54:06 +0000 |
commit | 111de438ea3e512a541281dc0716cc728ea8d152 (patch) | |
tree | 2c9ca866e79ed0cfc9299e553a87239345c515a6 /extensions | |
parent | d3f21849ec8580fdb59a1f0b35453657f4050e0f (diff) |
remove some manual ref-counting
triggered when I noticed a class doing acquire() in the constructor and
then release() in the destructor.
found mostly by
git grep -n -B5 -e '->release()'
Change-Id: Ie1abeaed75c1f861df185e3bde680272dbadc97f
Reviewed-on: https://gerrit.libreoffice.org/25363
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/source/bibliography/framectr.cxx | 22 | ||||
-rw-r--r-- | extensions/source/bibliography/framectr.hxx | 2 |
2 files changed, 11 insertions, 13 deletions
diff --git a/extensions/source/bibliography/framectr.cxx b/extensions/source/bibliography/framectr.cxx index ad713bd538cb..0e06fed4b1b1 100644 --- a/extensions/source/bibliography/framectr.cxx +++ b/extensions/source/bibliography/framectr.cxx @@ -178,15 +178,13 @@ BibFrameController_Impl::BibFrameController_Impl( const uno::Reference< awt::XWi pParent->SetUniqueId(UID_BIB_FRAME_WINDOW); bDisposing=false; bHierarchical=true; - pImp = new BibFrameCtrl_Impl; - pImp->pController = this; - pImp->acquire(); + mxImpl = new BibFrameCtrl_Impl; + mxImpl->pController = this; } BibFrameController_Impl::~BibFrameController_Impl() { - pImp->pController = nullptr; - pImp->release(); + mxImpl->pController = nullptr; delete pDatMan; if(pBibMod) CloseBibModul(pBibMod); @@ -213,7 +211,7 @@ css::uno::Sequence< OUString > SAL_CALL BibFrameController_Impl::getSupportedSer void BibFrameController_Impl::attachFrame( const uno::Reference< XFrame > & xArg ) throw (css::uno::RuntimeException, std::exception) { xFrame = xArg; - xFrame->addFrameActionListener( pImp ); + xFrame->addFrameActionListener( mxImpl ); } sal_Bool BibFrameController_Impl::attachModel( const uno::Reference< XModel > & /*xModel*/ ) throw (css::uno::RuntimeException, std::exception) @@ -224,9 +222,9 @@ sal_Bool BibFrameController_Impl::attachModel( const uno::Reference< XModel > & sal_Bool BibFrameController_Impl::suspend( sal_Bool bSuspend ) throw (css::uno::RuntimeException, std::exception) { if ( bSuspend ) - getFrame()->removeFrameActionListener( pImp ); + getFrame()->removeFrameActionListener( mxImpl ); else - getFrame()->addFrameActionListener( pImp ); + getFrame()->addFrameActionListener( mxImpl ); return true; } @@ -254,7 +252,7 @@ void BibFrameController_Impl::dispose() throw (css::uno::RuntimeException, std:: bDisposing = true; lang::EventObject aObject; aObject.Source = static_cast<XController*>(this); - pImp->aLC.disposeAndClear(aObject); + mxImpl->aLC.disposeAndClear(aObject); m_xDatMan = nullptr; pDatMan = nullptr; aStatusListeners.clear(); @@ -262,12 +260,12 @@ void BibFrameController_Impl::dispose() throw (css::uno::RuntimeException, std:: void BibFrameController_Impl::addEventListener( const uno::Reference< lang::XEventListener > & aListener ) throw (css::uno::RuntimeException, std::exception) { - pImp->aLC.addInterface( cppu::UnoType<lang::XEventListener>::get(), aListener ); + mxImpl->aLC.addInterface( cppu::UnoType<lang::XEventListener>::get(), aListener ); } void BibFrameController_Impl::removeEventListener( const uno::Reference< lang::XEventListener > & aListener ) throw (css::uno::RuntimeException, std::exception) { - pImp->aLC.removeInterface( cppu::UnoType<lang::XEventListener>::get(), aListener ); + mxImpl->aLC.removeInterface( cppu::UnoType<lang::XEventListener>::get(), aListener ); } uno::Reference< frame::XDispatch > BibFrameController_Impl::queryDispatch( const util::URL& aURL, const OUString& /*aTarget*/, sal_Int32 /*nSearchFlags*/ ) throw (css::uno::RuntimeException, std::exception) @@ -558,7 +556,7 @@ void BibFrameController_Impl::dispatch(const util::URL& _rURL, const uno::Sequen bLeft = xCursor->isLast() && nCount > 1; bRight= !xCursor->isLast(); // ask for confirmation - Reference< frame::XController > xCtrl = pImp->pController; + Reference< frame::XController > xCtrl = mxImpl->pController; Reference< form::XConfirmDeleteListener > xConfirm(pDatMan->GetFormController(),UNO_QUERY); if (xConfirm.is()) { diff --git a/extensions/source/bibliography/framectr.hxx b/extensions/source/bibliography/framectr.hxx index feb94c37c383..bcc574e3208b 100644 --- a/extensions/source/bibliography/framectr.hxx +++ b/extensions/source/bibliography/framectr.hxx @@ -60,7 +60,7 @@ class BibFrameController_Impl : public cppu::WeakImplHelper < > { friend class BibFrameCtrl_Impl; - BibFrameCtrl_Impl* pImp; + css::uno::Reference<BibFrameCtrl_Impl> mxImpl; BibStatusDispatchArr aStatusListeners; css::uno::Reference< css::awt::XWindow > xWindow; css::uno::Reference< css::frame::XFrame > xFrame; |