diff options
-rw-r--r-- | sc/inc/fielduno.hxx | 4 | ||||
-rw-r--r-- | sc/source/ui/unoobj/fielduno.cxx | 19 |
2 files changed, 9 insertions, 14 deletions
diff --git a/sc/inc/fielduno.hxx b/sc/inc/fielduno.hxx index 70b3aa31639b..a1678d68ee8e 100644 --- a/sc/inc/fielduno.hxx +++ b/sc/inc/fielduno.hxx @@ -63,7 +63,7 @@ private: ScAddress const aCellPos; std::unique_ptr<ScEditSource> mpEditSource; /// List of refresh listeners. - comphelper::OInterfaceContainerHelper2* mpRefreshListeners; + std::unique_ptr<comphelper::OInterfaceContainerHelper2> mpRefreshListeners; /// mutex to lock the InterfaceContainerHelper osl::Mutex aMutex; @@ -117,7 +117,7 @@ private: std::unique_ptr<ScEditSource> mpEditSource; /// List of refresh listeners. - comphelper::OInterfaceContainerHelper2* mpRefreshListeners; + std::unique_ptr<comphelper::OInterfaceContainerHelper2> mpRefreshListeners; /// mutex to lock the InterfaceContainerHelper osl::Mutex aMutex; diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx index 666eb8c7c88e..7c53309b1082 100644 --- a/sc/source/ui/unoobj/fielduno.cxx +++ b/sc/source/ui/unoobj/fielduno.cxx @@ -272,8 +272,7 @@ ScCellFieldsObj::ScCellFieldsObj( ScDocShell* pDocSh, const ScAddress& rPos) : mxContent(xContent), pDocShell( pDocSh ), - aCellPos( rPos ), - mpRefreshListeners( nullptr ) + aCellPos( rPos ) { pDocShell->GetDocument().AddUnoObject(*this); @@ -296,11 +295,8 @@ ScCellFieldsObj::~ScCellFieldsObj() { lang::EventObject aEvent; aEvent.Source.set(static_cast<cppu::OWeakObject*>(this)); - if (mpRefreshListeners) - { - mpRefreshListeners->disposeAndClear(aEvent); - DELETEZ( mpRefreshListeners ); - } + mpRefreshListeners->disposeAndClear(aEvent); + mpRefreshListeners.reset(); } } @@ -408,7 +404,7 @@ void SAL_CALL ScCellFieldsObj::addRefreshListener( const uno::Reference< util::X { SolarMutexGuard aGuard; if (!mpRefreshListeners) - mpRefreshListeners = new comphelper::OInterfaceContainerHelper2(aMutex); + mpRefreshListeners.reset( new comphelper::OInterfaceContainerHelper2(aMutex) ); mpRefreshListeners->addInterface(xListener); } } @@ -424,8 +420,7 @@ void SAL_CALL ScCellFieldsObj::removeRefreshListener( const uno::Reference<util: } ScHeaderFieldsObj::ScHeaderFieldsObj(ScHeaderFooterTextData& rData) : - mrData(rData), - mpRefreshListeners( nullptr ) + mrData(rData) { mpEditSource.reset( new ScHeaderFooterEditSource(rData) ); } @@ -442,7 +437,7 @@ ScHeaderFieldsObj::~ScHeaderFieldsObj() lang::EventObject aEvent; aEvent.Source = static_cast<cppu::OWeakObject*>(this); mpRefreshListeners->disposeAndClear(aEvent); - DELETEZ(mpRefreshListeners); + mpRefreshListeners.reset(); } } @@ -561,7 +556,7 @@ void SAL_CALL ScHeaderFieldsObj::addRefreshListener( const uno::Reference< util: { SolarMutexGuard aGuard; if (!mpRefreshListeners) - mpRefreshListeners = new comphelper::OInterfaceContainerHelper2(aMutex); + mpRefreshListeners.reset(new comphelper::OInterfaceContainerHelper2(aMutex)); mpRefreshListeners->addInterface(xListener); } } |