diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-19 12:27:03 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-19 13:06:47 +0200 |
commit | 6944b82d6d892e9921af659a4eabec5976511392 (patch) | |
tree | 1478f46e6934d677a3e4911505f7f46fbe6c9a48 /svx | |
parent | a024b6dfff0c773e8cfbefa7f6a9d3579ce8e759 (diff) |
use rtl::Reference in SdrOle2ObjImpl
instead of manual acquire/release
Change-Id: I7110073e9ada8c034295133468c38754e9b55b69
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/svdraw/svdoole2.cxx | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index 6e6609164b75..3b924abb13c1 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -84,6 +84,7 @@ #include <basegfx/polygon/b2dpolypolygon.hxx> #include <editeng/outlobj.hxx> #include <svx/svdpage.hxx> +#include <rtl/ref.hxx> using namespace ::com::sun::star; @@ -643,7 +644,7 @@ public: SdrEmbedObjectLink* mpObjectLink; OUString maLinkURL; - SvxUnoShapeModifyListener* mpModifyListener; + rtl::Reference<SvxUnoShapeModifyListener> mxModifyListener; explicit SdrOle2ObjImpl( bool bFrame ) : mpGraphic(nullptr), @@ -656,8 +657,7 @@ public: mbIsChart(false), mbLoadingOLEObjectFailed(false), mbConnected(false), - mpObjectLink(nullptr), - mpModifyListener(nullptr) + mpObjectLink(nullptr) { mxObjRef.Lock(); } @@ -674,8 +674,7 @@ public: mbIsChart(false), mbLoadingOLEObjectFailed(false), mbConnected(false), - mpObjectLink(nullptr), - mpModifyListener(nullptr) + mpObjectLink(nullptr) { mxObjRef.Lock(); } @@ -685,10 +684,9 @@ public: delete mpGraphic; delete mpGraphicObject; - if (mpModifyListener) + if (mxModifyListener.is()) { - mpModifyListener->invalidate(); - mpModifyListener->release(); + mxModifyListener->invalidate(); } } }; @@ -1099,16 +1097,15 @@ void SdrOle2Obj::AddListeners_Impl() if( mpImpl->mxObjRef.is() && mpImpl->mxObjRef->getCurrentState() != embed::EmbedStates::LOADED ) { // register modify listener - if (!mpImpl->mpModifyListener) + if (!mpImpl->mxModifyListener.is()) { - mpImpl->mpModifyListener = new SvxUnoShapeModifyListener(this); - mpImpl->mpModifyListener->acquire(); + mpImpl->mxModifyListener = new SvxUnoShapeModifyListener(this); } uno::Reference< util::XModifyBroadcaster > xBC( getXModel(), uno::UNO_QUERY ); - if (xBC.is() && mpImpl->mpModifyListener) + if (xBC.is()) { - uno::Reference<util::XModifyListener> xListener(mpImpl->mpModifyListener); + uno::Reference<util::XModifyListener> xListener(mpImpl->mxModifyListener.get()); xBC->addModifyListener( xListener ); } } @@ -1139,9 +1136,9 @@ void SdrOle2Obj::RemoveListeners_Impl() if ( nState != embed::EmbedStates::LOADED ) { uno::Reference< util::XModifyBroadcaster > xBC( getXModel(), uno::UNO_QUERY ); - if (xBC.is() && mpImpl->mpModifyListener) + if (xBC.is() && mpImpl->mxModifyListener.is()) { - uno::Reference<util::XModifyListener> xListener(mpImpl->mpModifyListener); + uno::Reference<util::XModifyListener> xListener(mpImpl->mxModifyListener.get()); xBC->removeModifyListener( xListener ); } } |