include/svx/fmgridif.hxx | 4 ++-- svx/source/fmcomp/fmgridif.cxx | 22 ++++++++-------------- 2 files changed, 10 insertions(+), 16 deletions(-)
New commits: commit a1e4def198f37cdc929211e44206875dd406d258 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Fri May 4 16:44:04 2018 +0200 loplugin:useuniqueptr in FmXGridPeer Change-Id: I05d6fd36bb92e88016ac9cb062c4443ec8796b97 Reviewed-on: https://gerrit.libreoffice.org/53882 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> 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(); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits