Kaydet (Commit) 22d36649 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in ScHeaderFieldsObj

Change-Id: I7d9855a45ebfb5bc185e964d4437ab0c9c2deff4
Reviewed-on: https://gerrit.libreoffice.org/63131
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 22483728
......@@ -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;
......
......@@ -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);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment