diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-07-06 10:52:27 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-07-06 16:21:14 +0200 |
commit | cc8a0de500b2abdef804b2d27aba36f7b7c95cab (patch) | |
tree | 5a3b949d897e271c166742559fe917dd9969379a /sw | |
parent | 4b7b93be530dd5b7924588fbc5855c6fd057984c (diff) |
ofz: fix some leaks
Change-Id: Icf43996a57aa4284b309e127431e7406b833d88f
Reviewed-on: https://gerrit.libreoffice.org/39642
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 | 3 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.hxx | 5 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par2.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par5.cxx | 20 |
4 files changed, 14 insertions, 16 deletions
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 05b0fdee3e4f..d99fb2dd96b0 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -4124,7 +4124,6 @@ SwWW8ImplReader::SwWW8ImplReader(sal_uInt8 nVersionPara, SotStorage* pStorage, , m_pDataStream(nullptr) , m_rDoc(rD) , m_pPaM(nullptr) - , m_pReffingStck(nullptr) , m_aSectionManager(*this) , m_aExtraneousParas(rD) , m_aInsertedTables(rD) @@ -4910,7 +4909,7 @@ ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss) variables instead. */ m_xReffedStck.reset(new SwWW8ReferencedFltEndStack(&m_rDoc, m_nFieldFlags)); - m_pReffingStck = new SwWW8FltRefStack(&m_rDoc, m_nFieldFlags); + m_xReffingStck.reset(new SwWW8FltRefStack(&m_rDoc, m_nFieldFlags)); m_xAnchorStck.reset(new SwWW8FltAnchorStack(&m_rDoc, m_nFieldFlags)); diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index 6d9ad31dfc63..575655fa3994 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -1102,7 +1102,7 @@ private: text/textboxes/tables etc... They are things that reference other things e.g. NoteRef and Ref, they are processed after pReffedStck */ - SwWW8FltRefStack *m_pReffingStck; + std::unique_ptr<SwWW8FltRefStack> m_xReffingStck; /* For graphics anchors. Determines the graphics whose anchors are in the @@ -1383,8 +1383,7 @@ private: void DeleteRefStacks() { DeleteStack(m_xReffedStck.release()); - DeleteStack( m_pReffingStck ); - m_pReffingStck = nullptr; + DeleteStack(m_xReffingStck.release()); } void DeleteAnchorStack() { diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index 75d76dc9f2ed..ab5f55e9ece5 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -398,7 +398,7 @@ sal_uInt16 SwWW8ImplReader::End_Footnote() if (rText.getLength() > 1 && rText[1] == 0x09) ++m_pPaM->GetMark()->nContent; ++m_pPaM->GetMark()->nContent; - m_pReffingStck->Delete(*m_pPaM); + m_xReffingStck->Delete(*m_pPaM); m_rDoc.getIDocumentContentOperations().DeleteRange( *m_pPaM ); m_pPaM->DeleteMark(); } diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 95f30fe88a98..72be1a7e4d0a 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -1249,13 +1249,13 @@ long SwWW8ImplReader::MapBookmarkVariables(const WW8FieldDesc* pF, } else { - nNo = m_pReffingStck->aFieldVarNames.size()+1; + nNo = m_xReffingStck->aFieldVarNames.size()+1; sName = "WWSetBkmk" + OUString::number(nNo); nNo += m_xPlcxMan->GetBook()->GetIMax(); } m_xReffedStck->NewAttr(*m_pPaM->GetPoint(), SwFltBookmark( BookmarkToWriter(sName), rData, nNo )); - m_pReffingStck->aFieldVarNames[rOrigName] = sName; + m_xReffingStck->aFieldVarNames[rOrigName] = sName; return nNo; } @@ -1301,9 +1301,9 @@ OUString SwWW8ImplReader::GetMappedBookmark(const OUString &rOrigName) //See if there has been a variable set with this name, if so get //the pseudo bookmark name that was set with it. std::map<OUString, OUString, SwWW8::ltstr>::const_iterator aResult = - m_pReffingStck->aFieldVarNames.find(sName); + m_xReffingStck->aFieldVarNames.find(sName); - return (aResult == m_pReffingStck->aFieldVarNames.end()) + return (aResult == m_xReffingStck->aFieldVarNames.end()) ? sName : (*aResult).second; } @@ -2048,8 +2048,8 @@ eF_ResT SwWW8ImplReader::Read_F_Ref( WW8FieldDesc*, OUString& rStr ) must store it until the end of the document to see if it was, in which case we'll turn it into a show variable */ - m_pReffingStck->NewAttr( *m_pPaM->GetPoint(), SwFormatField(aField) ); - m_pReffingStck->SetAttr( *m_pPaM->GetPoint(), RES_TXTATR_FIELD); + m_xReffingStck->NewAttr( *m_pPaM->GetPoint(), SwFormatField(aField) ); + m_xReffingStck->SetAttr( *m_pPaM->GetPoint(), RES_TXTATR_FIELD); } else { @@ -2095,15 +2095,15 @@ eF_ResT SwWW8ImplReader::Read_F_NoteReference( WW8FieldDesc*, OUString& rStr ) SwGetRefField aField( static_cast<SwGetRefFieldType*>( m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::GetRef )), aBkmName, REF_FOOTNOTE, 0, REF_ONLYNUMBER ); - m_pReffingStck->NewAttr(*m_pPaM->GetPoint(), SwFormatField(aField)); - m_pReffingStck->SetAttr(*m_pPaM->GetPoint(), RES_TXTATR_FIELD); + m_xReffingStck->NewAttr(*m_pPaM->GetPoint(), SwFormatField(aField)); + m_xReffingStck->SetAttr(*m_pPaM->GetPoint(), RES_TXTATR_FIELD); if (bAboveBelow) { SwGetRefField aField2( static_cast<SwGetRefFieldType*>( m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::GetRef )),aBkmName, REF_FOOTNOTE, 0, REF_UPDOWN ); - m_pReffingStck->NewAttr(*m_pPaM->GetPoint(), SwFormatField(aField2)); - m_pReffingStck->SetAttr(*m_pPaM->GetPoint(), RES_TXTATR_FIELD); + m_xReffingStck->NewAttr(*m_pPaM->GetPoint(), SwFormatField(aField2)); + m_xReffingStck->SetAttr(*m_pPaM->GetPoint(), RES_TXTATR_FIELD); } return eF_ResT::OK; } |