diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-07-06 09:56:02 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-07-06 14:52:40 +0200 |
commit | d28b5faa4a9b92e5b94ebaaf5395b0108564d8bf (patch) | |
tree | 7cbe1834336086343968e68bd4dfe3130ef2c313 /sw | |
parent | 800ac37021e3f8859a52c5eebca261a5d3bc5a11 (diff) |
ofz: fix some leaks
Change-Id: I7394f9b9c51fd827c5381119d32f5c75a95feb5c
Reviewed-on: https://gerrit.libreoffice.org/39632
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 16 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.hxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par2.cxx | 15 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par4.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par5.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par6.cxx | 2 |
6 files changed, 18 insertions, 23 deletions
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index e9093bad8236..94a114b1d245 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -1966,7 +1966,7 @@ WW8ReaderSave::WW8ReaderSave(SwWW8ImplReader* pRdr ,WW8_CP nStartCp) : maTmpPos(*pRdr->m_pPaM->GetPoint()), mpOldStck(pRdr->m_pCtrlStck), mpOldAnchorStck(pRdr->m_pAnchorStck), - mpOldRedlines(pRdr->m_pRedlineStack), + mxOldRedlines(std::move(pRdr->m_xRedlineStack)), mxOldPlcxMan(pRdr->m_xPlcxMan), mpWFlyPara(pRdr->m_xWFlyPara.release()), mpSFlyPara(pRdr->m_xSFlyPara.release()), @@ -2001,7 +2001,7 @@ WW8ReaderSave::WW8ReaderSave(SwWW8ImplReader* pRdr ,WW8_CP nStartCp) : pRdr->m_pCtrlStck = new SwWW8FltControlStack(&pRdr->m_rDoc, pRdr->m_nFieldFlags, *pRdr); - pRdr->m_pRedlineStack = new sw::util::RedlineStack(pRdr->m_rDoc); + pRdr->m_xRedlineStack.reset(new sw::util::RedlineStack(pRdr->m_rDoc)); pRdr->m_pAnchorStck = new SwWW8FltAnchorStack(&pRdr->m_rDoc, pRdr->m_nFieldFlags); @@ -2046,9 +2046,8 @@ void WW8ReaderSave::Restore( SwWW8ImplReader* pRdr ) pRdr->DeleteCtrlStack(); pRdr->m_pCtrlStck = mpOldStck; - pRdr->m_pRedlineStack->closeall(*pRdr->m_pPaM->GetPoint()); - delete pRdr->m_pRedlineStack; - pRdr->m_pRedlineStack = mpOldRedlines; + pRdr->m_xRedlineStack->closeall(*pRdr->m_pPaM->GetPoint()); + pRdr->m_xRedlineStack = std::move(mxOldRedlines); pRdr->DeleteAnchorStack(); pRdr->m_pAnchorStck = mpOldAnchorStck; @@ -4126,7 +4125,6 @@ SwWW8ImplReader::SwWW8ImplReader(sal_uInt8 nVersionPara, SotStorage* pStorage, , m_rDoc(rD) , m_pPaM(nullptr) , m_pCtrlStck(nullptr) - , m_pRedlineStack(nullptr) , m_pReffedStck(nullptr) , m_pReffingStck(nullptr) , m_pAnchorStck(nullptr) @@ -4914,7 +4912,7 @@ ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss) m_pCtrlStck = new SwWW8FltControlStack( &m_rDoc, m_nFieldFlags, *this ); - m_pRedlineStack = new sw::util::RedlineStack(m_rDoc); + m_xRedlineStack.reset(new sw::util::RedlineStack(m_rDoc)); /* RefFieldStck: Keeps track of bookmarks which may be inserted as @@ -5261,8 +5259,8 @@ ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss) m_pTableStream = nullptr; DeleteCtrlStack(); - m_pRedlineStack->closeall(*m_pPaM->GetPoint()); - delete m_pRedlineStack; + m_xRedlineStack->closeall(*m_pPaM->GetPoint()); + m_xRedlineStack.reset(); DeleteAnchorStack(); DeleteRefStacks(); diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index 2df2d0c40ab1..8dd996aea741 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -582,7 +582,7 @@ private: std::deque<WW8FieldEntry> maOldFieldStack; SwWW8FltControlStack* mpOldStck; SwWW8FltAnchorStack* mpOldAnchorStck; - sw::util::RedlineStack *mpOldRedlines; + std::unique_ptr<sw::util::RedlineStack> mxOldRedlines; std::shared_ptr<WW8PLCFMan> mxOldPlcxMan; WW8FlyPara* mpWFlyPara; WW8SwFlyPara* mpSFlyPara; @@ -1087,7 +1087,7 @@ private: This stack is for redlines, because their sequence of discovery can be out of order of their order of insertion into the document. */ - sw::util::RedlineStack *m_pRedlineStack; + std::unique_ptr<sw::util::RedlineStack> m_xRedlineStack; /* This stack is for fields that get referenced later, e.g. BookMarks and TOX. diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index d7c4da72d7f7..beee5a928ccc 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -142,7 +142,7 @@ WW8TabBandDesc::~WW8TabBandDesc() class WW8TabDesc { std::vector<OUString> m_aNumRuleNames; - sw::util::RedlineStack *mpOldRedlineStack; + std::unique_ptr<sw::util::RedlineStack> mxOldRedlineStack; SwWW8ImplReader* m_pIo; @@ -234,7 +234,7 @@ public: OUString GetNumRuleName() const; void SetNumRuleName( const OUString& rName ); - sw::util::RedlineStack* getOldRedlineStack(){ return mpOldRedlineStack; } + sw::util::RedlineStack* getOldRedlineStack() { return mxOldRedlineStack.get(); } }; void sw::util::RedlineStack::close( const SwPosition& rPos, @@ -1828,7 +1828,6 @@ wwTableSprm GetTableSprm(sal_uInt16 nId, ww::WordVersion eVer) } WW8TabDesc::WW8TabDesc(SwWW8ImplReader* pIoClass, WW8_CP nStartCp) : - mpOldRedlineStack(nullptr), m_pIo(pIoClass), m_pFirstBand(nullptr), m_pActBand(nullptr), @@ -2604,8 +2603,8 @@ void WW8TabDesc::CreateSwTable() } } - mpOldRedlineStack = m_pIo->m_pRedlineStack; - m_pIo->m_pRedlineStack = new sw::util::RedlineStack(m_pIo->m_rDoc); + mxOldRedlineStack = std::move(m_pIo->m_xRedlineStack); + m_pIo->m_xRedlineStack.reset(new sw::util::RedlineStack(m_pIo->m_rDoc)); } void WW8TabDesc::UseSwTable() @@ -2817,10 +2816,8 @@ void WW8TabDesc::MoveOutsideTable() void WW8TabDesc::FinishSwTable() { - m_pIo->m_pRedlineStack->closeall(*m_pIo->m_pPaM->GetPoint()); - delete m_pIo->m_pRedlineStack; - m_pIo->m_pRedlineStack = mpOldRedlineStack; - mpOldRedlineStack = nullptr; + m_pIo->m_xRedlineStack->closeall(*m_pIo->m_pPaM->GetPoint()); + m_pIo->m_xRedlineStack = std::move(mxOldRedlineStack); WW8DupProperties aDup(m_pIo->m_rDoc,m_pIo->m_pCtrlStck); m_pIo->m_pCtrlStck->SetAttr( *m_pIo->m_pPaM->GetPoint(), 0, false); diff --git a/sw/source/filter/ww8/ww8par4.cxx b/sw/source/filter/ww8/ww8par4.cxx index 8cd1dc4836de..cc8d795d962e 100644 --- a/sw/source/filter/ww8/ww8par4.cxx +++ b/sw/source/filter/ww8/ww8par4.cxx @@ -507,7 +507,7 @@ void SwWW8ImplReader::Read_CRevisionMark(RedlineType_t eType, } if (nLen < 0) - m_pRedlineStack->close(*m_pPaM->GetPoint(), eType, m_pTableDesc ); + m_xRedlineStack->close(*m_pPaM->GetPoint(), eType, m_pTableDesc ); else { // start of new revision mark, if not there default to first entry diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 64c61713168b..184c4d9523b7 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -610,7 +610,7 @@ sal_uInt16 SwWW8ImplReader::End_Field() { // adapt redline positions to inserted field mark start // dummy char (assume not necessary for end dummy char) - m_pRedlineStack->MoveAttrs(*aFieldPam.Start()); + m_xRedlineStack->MoveAttrs(*aFieldPam.Start()); const IFieldmark::parameter_map_t& rParametersToAdd = m_aFieldStack.back().getParameters(); pFieldmark->GetParameters()->insert(rParametersToAdd.begin(), rParametersToAdd.end()); OUString sFieldId = OUString::number( m_aFieldStack.back().mnFieldId ); diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 9f8ca0befd7d..8145743f47e5 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -2644,7 +2644,7 @@ void SwWW8ImplReader::NewAttr( const SfxPoolItem& rAttr, } else if (rAttr.Which() == RES_FLTR_REDLINE) { - m_pRedlineStack->open(*m_pPaM->GetPoint(), rAttr); + m_xRedlineStack->open(*m_pPaM->GetPoint(), rAttr); } else { |