summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-11-06 09:26:05 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-11-09 06:42:47 +0100
commit22d36649a3087b9f8eec74c05fa33f87423619a4 (patch)
tree33ed726057dee66a1c7bf3086d4b4763d5937c06
parent224837289cb6c6753026173b35142b10e7e1538e (diff)
loplugin:useuniqueptr in ScHeaderFieldsObj
Change-Id: I7d9855a45ebfb5bc185e964d4437ab0c9c2deff4 Reviewed-on: https://gerrit.libreoffice.org/63131 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sc/inc/fielduno.hxx4
-rw-r--r--sc/source/ui/unoobj/fielduno.cxx19
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);
}
}