From 714ba513d3079c36145ed18826141d54d72a1744 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 18 Jan 2018 09:03:13 +0000 Subject: ofz#5462 Direct-leak MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ic2b7d139ebb6e88fac5cf9f4cf8dbec26905bcdc Reviewed-on: https://gerrit.libreoffice.org/48097 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- lotuswordpro/source/filter/lwppara.cxx | 29 +++++++++++++---------------- lotuswordpro/source/filter/lwppara.hxx | 10 +++++----- 2 files changed, 18 insertions(+), 21 deletions(-) (limited to 'lotuswordpro') diff --git a/lotuswordpro/source/filter/lwppara.cxx b/lotuswordpro/source/filter/lwppara.cxx index 0c9c59d6fd2d..d831268d8711 100644 --- a/lotuswordpro/source/filter/lwppara.cxx +++ b/lotuswordpro/source/filter/lwppara.cxx @@ -117,7 +117,6 @@ LwpPara::LwpPara(LwpObjectHeader const & objHdr, LwpSvStream* pStrm) , m_nChars(0) , m_pDropcapLayout(nullptr) , m_BelowSpacing(0) - , m_pXFContainer(nullptr) { } @@ -236,19 +235,18 @@ void LwpPara::Read() void LwpPara::Parse(IXFStream* pOutputStream) { - m_pXFContainer = new XFContentContainer; - XFConvert(m_pXFContainer); - if (!m_pXFContainer) + m_xXFContainer.set(new XFContentContainer); + XFConvert(m_xXFContainer.get()); + if (!m_xXFContainer) return; - m_pXFContainer->ToXml(pOutputStream); - m_pXFContainer->Reset(); - delete m_pXFContainer; - m_pXFContainer = nullptr; + m_xXFContainer->ToXml(pOutputStream); + m_xXFContainer->Reset(); + m_xXFContainer.clear(); } void LwpPara::XFConvert(XFContentContainer* pCont) { - m_pXFContainer = pCont; + m_xXFContainer.set(pCont); LwpStory *pStory = dynamic_cast(m_Story.obj().get()); @@ -272,19 +270,18 @@ void LwpPara::XFConvert(XFContentContainer* pCont) XFSection* pSection = CreateXFSection(); if (pStory) pStory->AddXFContent(pSection); - //pSection->Add(pPara); - m_pXFContainer = pSection; + m_xXFContainer.set(pSection); } if (m_bHasBullet && m_pSilverBullet) { - rtl::Reference xListItem = AddBulletList(m_pXFContainer); + rtl::Reference xListItem = AddBulletList(m_xXFContainer.get()); if (xListItem) { xListItem->Add(pPara); } } - else if (m_pXFContainer) + else if (m_xXFContainer) { LwpBulletStyleMgr* pBulletStyleMgr = GetBulletStyleMgr(); if (pBulletStyleMgr) @@ -292,14 +289,14 @@ void LwpPara::XFConvert(XFContentContainer* pCont) pBulletStyleMgr->SetCurrentSilverBullet(LwpObjectID()); pBulletStyleMgr->SetContinueFlag(false); } - m_pXFContainer->Add(pPara); + m_xXFContainer->Add(pPara); } m_Fribs.SetXFPara(pPara); m_Fribs.XFConvert(); - if (m_pBreaks && m_pXFContainer) - AddBreakAfter(m_pXFContainer); + if (m_pBreaks && m_xXFContainer) + AddBreakAfter(m_xXFContainer.get()); } void LwpPara::RegisterMasterPage(XFParaStyle const * pBaseStyle) diff --git a/lotuswordpro/source/filter/lwppara.hxx b/lotuswordpro/source/filter/lwppara.hxx index 2b662ea75204..c18b9dee9d03 100644 --- a/lotuswordpro/source/filter/lwppara.hxx +++ b/lotuswordpro/source/filter/lwppara.hxx @@ -231,7 +231,7 @@ protected: LwpDropcapLayout* m_pDropcapLayout; double m_BelowSpacing; - XFContentContainer* m_pXFContainer; //Current container for VO_PARA + rtl::Reference m_xXFContainer; //Current container for VO_PARA enum { @@ -309,7 +309,7 @@ inline LwpFribPtr& LwpPara::GetFribs() } inline XFContentContainer* LwpPara::GetXFContainer() { - return m_pXFContainer; + return m_xXFContainer.get(); } inline const OUString& LwpPara::GetBulletStyleName() const { @@ -317,13 +317,13 @@ inline const OUString& LwpPara::GetBulletStyleName() const } inline void LwpPara::AddXFContent(XFContent* pCont) { - if (!m_pXFContainer) + if (!m_xXFContainer) throw std::runtime_error("paragraph lacks container"); - m_pXFContainer->Add(pCont); + m_xXFContainer->Add(pCont); } inline void LwpPara::SetXFContainer(XFContentContainer* pCont) { - m_pXFContainer = pCont; + m_xXFContainer.set(pCont); } inline LwpIndentOverride* LwpPara::GetIndent() { -- cgit