summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-05-04 16:44:04 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-05-07 08:34:14 +0200
commita1e4def198f37cdc929211e44206875dd406d258 (patch)
treec9483b5c6a21725c07018d667a2a2237f32d9d16
parentdbba08c7d430948775d47164c760ea1100442beb (diff)
loplugin:useuniqueptr in FmXGridPeer
Change-Id: I05d6fd36bb92e88016ac9cb062c4443ec8796b97 Reviewed-on: https://gerrit.libreoffice.org/53882 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--include/svx/fmgridif.hxx4
-rw-r--r--svx/source/fmcomp/fmgridif.cxx22
2 files changed, 10 insertions, 16 deletions
diff --git a/include/svx/fmgridif.hxx b/include/svx/fmgridif.hxx
index 546b4442cbd3..f031f3f15565 100644
--- a/include/svx/fmgridif.hxx
+++ b/include/svx/fmgridif.hxx
@@ -351,9 +351,9 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC FmXGridPeer:
bool m_bInterceptingDispatch;
- bool* m_pStateCache;
+ std::unique_ptr<bool[]> m_pStateCache;
// one bool for each supported url
- css::uno::Reference< css::frame::XDispatch > * m_pDispatchers;
+ std::unique_ptr<css::uno::Reference< css::frame::XDispatch >[]> m_pDispatchers;
// one dispatcher for each supported url
// (I would like to have a vector here but including the stl in an exported file seems
// very risky to me ....)
diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx
index e7c6fa716127..e3cee1d1e471 100644
--- a/svx/source/fmcomp/fmgridif.cxx
+++ b/svx/source/fmcomp/fmgridif.cxx
@@ -2715,10 +2715,8 @@ void FmXGridPeer::UpdateDispatches()
if (!nDispatchersGot)
{
- delete[] m_pStateCache;
- delete[] m_pDispatchers;
- m_pStateCache = nullptr;
- m_pDispatchers = nullptr;
+ m_pStateCache.reset();
+ m_pDispatchers.reset();
}
}
@@ -2735,8 +2733,8 @@ void FmXGridPeer::ConnectToDispatcher()
const Sequence< css::util::URL>& aSupportedURLs = getSupportedURLs();
// _before_ adding the status listeners (as the add should result in a statusChanged-call) !
- m_pStateCache = new bool[aSupportedURLs.getLength()];
- m_pDispatchers = new Reference< css::frame::XDispatch > [aSupportedURLs.getLength()];
+ m_pStateCache.reset(new bool[aSupportedURLs.getLength()]);
+ m_pDispatchers.reset(new Reference< css::frame::XDispatch > [aSupportedURLs.getLength()]);
sal_uInt16 nDispatchersGot = 0;
const css::util::URL* pSupportedURLs = aSupportedURLs.getConstArray();
@@ -2753,10 +2751,8 @@ void FmXGridPeer::ConnectToDispatcher()
if (!nDispatchersGot)
{
- delete[] m_pStateCache;
- delete[] m_pDispatchers;
- m_pStateCache = nullptr;
- m_pDispatchers = nullptr;
+ m_pStateCache.reset();
+ m_pDispatchers.reset();
}
}
@@ -2775,10 +2771,8 @@ void FmXGridPeer::DisConnectFromDispatcher()
m_pDispatchers[i]->removeStatusListener(static_cast<css::frame::XStatusListener*>(this), *pSupportedURLs);
}
- delete[] m_pStateCache;
- delete[] m_pDispatchers;
- m_pStateCache = nullptr;
- m_pDispatchers = nullptr;
+ m_pStateCache.reset();
+ m_pDispatchers.reset();
}