include/canvas/vclwrapper.hxx | 10 +++++----- sw/source/filter/ww8/ww8scan.cxx | 7 ++----- sw/source/filter/ww8/ww8scan.hxx | 2 +- 3 files changed, 8 insertions(+), 11 deletions(-)
New commits: commit 96b36edb8963706560a55a5e93a471e39ebd846f Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri Aug 3 15:57:10 2018 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Mon Aug 6 08:49:22 2018 +0200 loplugin:useuniqueptr in VCLObject Change-Id: Ib31e3ea5c4ac59ff526e85b6156a06130ad20311 Reviewed-on: https://gerrit.libreoffice.org/58572 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/include/canvas/vclwrapper.hxx b/include/canvas/vclwrapper.hxx index e35cb5fa13b9..77cf8b705e11 100644 --- a/include/canvas/vclwrapper.hxx +++ b/include/canvas/vclwrapper.hxx @@ -63,7 +63,7 @@ namespace canvas // no explicit here. VCLObjects should be freely // constructible with Wrappees, and AFAIK there is no other // implicit conversion path that could cause harm here - VCLObject( Wrappee* pWrappee ) : + VCLObject( std::unique_ptr<Wrappee> pWrappee ) : mpWrappee( pWrappee ) { } @@ -122,11 +122,11 @@ namespace canvas // protecting object deletion with the solar mutex SolarMutexGuard aGuard; - delete mpWrappee; + mpWrappee.reset(); } - Wrappee* operator->() { return mpWrappee; } - const Wrappee* operator->() const { return mpWrappee; } + Wrappee* operator->() { return mpWrappee.get(); } + const Wrappee* operator->() const { return mpWrappee.get(); } Wrappee& operator*() { return *mpWrappee; } const Wrappee& operator*() const { return *mpWrappee; } @@ -141,7 +141,7 @@ namespace canvas private: - Wrappee* mpWrappee; + std::unique_ptr<Wrappee> mpWrappee; }; } commit fa0f81614f456ed61a73dd3c8b7d1a534badfff5 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri Aug 3 15:56:54 2018 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Mon Aug 6 08:49:07 2018 +0200 loplugin:useuniqueptr in WW8PLCFx_FactoidBook Change-Id: I1ae19c5d0673be4bbc9786539f1e1996e4b4784c Reviewed-on: https://gerrit.libreoffice.org/58571 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 50d1438093f1..0a022fba94d2 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -4668,13 +4668,12 @@ WW8PLCFx_FactoidBook::WW8PLCFx_FactoidBook(SvStream* pTableSt, const WW8Fib& rFi { if (!rFib.m_fcPlcfBkfFactoid || !rFib.m_lcbPlcfBkfFactoid || !rFib.m_fcPlcfBklFactoid || !rFib.m_lcbPlcfBklFactoid) { - m_pBook[0] = m_pBook[1] = nullptr; m_nIMax = 0; } else { - m_pBook[0] = new WW8PLCFspecial(pTableSt, rFib.m_fcPlcfBkfFactoid, rFib.m_lcbPlcfBkfFactoid, 6); - m_pBook[1] = new WW8PLCFspecial(pTableSt, rFib.m_fcPlcfBklFactoid, rFib.m_lcbPlcfBklFactoid, 4); + m_pBook[0].reset(new WW8PLCFspecial(pTableSt, rFib.m_fcPlcfBkfFactoid, rFib.m_lcbPlcfBkfFactoid, 6)); + m_pBook[1].reset(new WW8PLCFspecial(pTableSt, rFib.m_fcPlcfBklFactoid, rFib.m_lcbPlcfBklFactoid, 4)); m_nIMax = m_pBook[0]->GetIMax(); if (m_pBook[1]->GetIMax() < m_nIMax) @@ -4684,8 +4683,6 @@ WW8PLCFx_FactoidBook::WW8PLCFx_FactoidBook(SvStream* pTableSt, const WW8Fib& rFi WW8PLCFx_FactoidBook::~WW8PLCFx_FactoidBook() { - delete m_pBook[1]; - delete m_pBook[0]; } sal_uInt32 WW8PLCFx_FactoidBook::GetIdx() const diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx index 9d371a867879..779828794cc8 100644 --- a/sw/source/filter/ww8/ww8scan.hxx +++ b/sw/source/filter/ww8/ww8scan.hxx @@ -820,7 +820,7 @@ class WW8PLCFx_FactoidBook : public WW8PLCFx { private: /// Start and end positions. - WW8PLCFspecial* m_pBook[2]; + std::unique_ptr<WW8PLCFspecial> m_pBook[2]; /// Number of factoid marks sal_Int32 m_nIMax; bool m_bIsEnd; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits