diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-07-06 10:35:02 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-07-06 15:20:42 +0200 |
commit | 2a72602824bf8aec44319e7fb9fe6dd3cebc72b3 (patch) | |
tree | a7145d8d25dbac89225419899c9539384391c353 /sw | |
parent | aff5cd7ed5d1cbe05975365d7aa9aff74fe5a861 (diff) |
ofz: fix some leaks
Change-Id: I73806c0fff325159c624e87338aac3bbe61c9382
Reviewed-on: https://gerrit.libreoffice.org/39639
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 | 5 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.hxx | 5 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par5.cxx | 30 |
3 files changed, 19 insertions, 21 deletions
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index fcf2ebc7973e..33901018139c 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -2149,7 +2149,7 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes) m_rDoc.getIDocumentContentOperations().InsertPoolItem(aEnd, SwFormatField(aPostIt)); m_pCtrlStck->SetAttr(*aEnd.GetPoint(), RES_CHRATR_HIDDEN); // If this is a range, make sure that it ends after the just inserted character, not before it. - m_pReffedStck->MoveAttrs(*aEnd.GetPoint()); + m_xReffedStck->MoveAttrs(*aEnd.GetPoint()); return 0; } @@ -4125,7 +4125,6 @@ SwWW8ImplReader::SwWW8ImplReader(sal_uInt8 nVersionPara, SotStorage* pStorage, , m_rDoc(rD) , m_pPaM(nullptr) , m_pCtrlStck(nullptr) - , m_pReffedStck(nullptr) , m_pReffingStck(nullptr) , m_pAnchorStck(nullptr) , m_aSectionManager(*this) @@ -4912,7 +4911,7 @@ ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss) RefFieldStck: Keeps track of bookmarks which may be inserted as variables instead. */ - m_pReffedStck = new SwWW8ReferencedFltEndStack(&m_rDoc, m_nFieldFlags); + m_xReffedStck.reset(new SwWW8ReferencedFltEndStack(&m_rDoc, m_nFieldFlags)); m_pReffingStck = new SwWW8FltRefStack(&m_rDoc, m_nFieldFlags); m_pAnchorStck = new SwWW8FltAnchorStack(&m_rDoc, m_nFieldFlags); diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index 87692b8ebfe4..f9f2364cc227 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -1094,7 +1094,7 @@ private: They get inserted at the end of the document, it is the same stack for headers/footers/main text/textboxes/tables etc... */ - SwWW8ReferencedFltEndStack *m_pReffedStck; + std::unique_ptr<SwWW8ReferencedFltEndStack> m_xReffedStck; /* This stack is for fields whose true conversion cannot be determined until @@ -1379,8 +1379,7 @@ private: void DeleteCtrlStack() { DeleteStack( m_pCtrlStck ); m_pCtrlStck = nullptr; } void DeleteRefStacks() { - DeleteStack( m_pReffedStck ); - m_pReffedStck = nullptr; + DeleteStack(m_xReffedStck.release()); DeleteStack( m_pReffingStck ); m_pReffingStck = nullptr; } diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 26191ca0ca20..4087540c6bb9 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -134,7 +134,7 @@ long SwWW8ImplReader::Read_Book(WW8PLCFManResult*) if (pB->GetIsEnd()) { - m_pReffedStck->SetAttr(*m_pPaM->GetPoint(), RES_FLTR_BOOKMARK, true, + m_xReffedStck->SetAttr(*m_pPaM->GetPoint(), RES_FLTR_BOOKMARK, true, pB->GetHandle(), (eB & BOOK_FIELD)!=0); return 0; } @@ -229,7 +229,7 @@ long SwWW8ImplReader::Read_Book(WW8PLCFManResult*) } const OUString sOrigName = BookmarkToWriter(*pName); - m_pReffedStck->NewAttr( aStart, + m_xReffedStck->NewAttr( aStart, SwFltBookmark( EnsureTOCBookmarkName( sOrigName ), aVal, pB->GetHandle(), IsTOCBookmarkName( sOrigName ) )); return 0; } @@ -239,9 +239,9 @@ long SwWW8ImplReader::Read_AtnBook(WW8PLCFManResult*) if (WW8PLCFx_AtnBook* pAtnBook = m_xPlcxMan->GetAtnBook()) { if (pAtnBook->getIsEnd()) - m_pReffedStck->SetAttr(*m_pPaM->GetPoint(), RES_FLTR_ANNOTATIONMARK, true, pAtnBook->getHandle()); + m_xReffedStck->SetAttr(*m_pPaM->GetPoint(), RES_FLTR_ANNOTATIONMARK, true, pAtnBook->getHandle()); else - m_pReffedStck->NewAttr(*m_pPaM->GetPoint(), CntUInt16Item(RES_FLTR_ANNOTATIONMARK, pAtnBook->getHandle())); + m_xReffedStck->NewAttr(*m_pPaM->GetPoint(), CntUInt16Item(RES_FLTR_ANNOTATIONMARK, pAtnBook->getHandle())); } return 0; } @@ -251,13 +251,13 @@ long SwWW8ImplReader::Read_FactoidBook(WW8PLCFManResult*) if (WW8PLCFx_FactoidBook* pFactoidBook = m_xPlcxMan->GetFactoidBook()) { if (pFactoidBook->getIsEnd()) - m_pReffedStck->SetAttr(*m_pPaM->GetPoint(), RES_FLTR_RDFMARK, true, pFactoidBook->getHandle()); + m_xReffedStck->SetAttr(*m_pPaM->GetPoint(), RES_FLTR_RDFMARK, true, pFactoidBook->getHandle()); else { SwFltRDFMark aMark; aMark.SetHandle(pFactoidBook->getHandle()); GetSmartTagInfo(aMark); - m_pReffedStck->NewAttr(*m_pPaM->GetPoint(), aMark); + m_xReffedStck->NewAttr(*m_pPaM->GetPoint(), aMark); } } return 0; @@ -1253,7 +1253,7 @@ long SwWW8ImplReader::MapBookmarkVariables(const WW8FieldDesc* pF, sName = "WWSetBkmk" + OUString::number(nNo); nNo += m_xPlcxMan->GetBook()->GetIMax(); } - m_pReffedStck->NewAttr(*m_pPaM->GetPoint(), + m_xReffedStck->NewAttr(*m_pPaM->GetPoint(), SwFltBookmark( BookmarkToWriter(sName), rData, nNo )); m_pReffingStck->aFieldVarNames[rOrigName] = sName; return nNo; @@ -1359,7 +1359,7 @@ eF_ResT SwWW8ImplReader::Read_F_InputVar( WW8FieldDesc* pF, OUString& rStr ) m_rDoc.getIDocumentContentOperations().InsertPoolItem( *m_pPaM, SwFormatField( aField ) ); - m_pReffedStck->SetAttr(*m_pPaM->GetPoint(), RES_FLTR_BOOKMARK, true, nNo); + m_xReffedStck->SetAttr(*m_pPaM->GetPoint(), RES_FLTR_BOOKMARK, true, nNo); return eF_ResT::OK; } @@ -1970,7 +1970,7 @@ eF_ResT SwWW8ImplReader::Read_F_Set( WW8FieldDesc* pF, OUString& rStr ) m_rDoc.getIDocumentContentOperations().InsertPoolItem( *m_pPaM, SwFormatField( aField ) ); - m_pReffedStck->SetAttr(*m_pPaM->GetPoint(), RES_FLTR_BOOKMARK, true, nNo); + m_xReffedStck->SetAttr(*m_pPaM->GetPoint(), RES_FLTR_BOOKMARK, true, nNo); return eF_ResT::OK; } @@ -2033,7 +2033,7 @@ eF_ResT SwWW8ImplReader::Read_F_Ref( WW8FieldDesc*, OUString& rStr ) { sBkmName = EnsureTOCBookmarkName(sBkmName); // track <sBookmarkName> as referenced TOC bookmark. - m_pReffedStck->aReferencedTOCBookmarks.insert( sBkmName ); + m_xReffedStck->aReferencedTOCBookmarks.insert( sBkmName ); } SwGetRefField aField( @@ -2141,7 +2141,7 @@ eF_ResT SwWW8ImplReader::Read_F_PgRef( WW8FieldDesc*, OUString& rStr ) { sBookmarkName = EnsureTOCBookmarkName(sName); // track <sBookmarkName> as referenced TOC bookmark. - m_pReffedStck->aReferencedTOCBookmarks.insert( sBookmarkName ); + m_xReffedStck->aReferencedTOCBookmarks.insert( sBookmarkName ); } else { @@ -2167,7 +2167,7 @@ eF_ResT SwWW8ImplReader::Read_F_PgRef( WW8FieldDesc*, OUString& rStr ) { sPageRefBookmarkName = EnsureTOCBookmarkName(sName); // track <sPageRefBookmarkName> as referenced TOC bookmark. - m_pReffedStck->aReferencedTOCBookmarks.insert( sPageRefBookmarkName ); + m_xReffedStck->aReferencedTOCBookmarks.insert( sPageRefBookmarkName ); } else { @@ -3378,7 +3378,7 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, OUString& rStr ) aFltTOX.SetHadPageDescItem(true); // Set start in stack - m_pReffedStck->NewAttr( *pPos, aFltTOX ); + m_xReffedStck->NewAttr( *pPos, aFltTOX ); m_rDoc.InsertTableOf(*m_pPaM->GetPoint(), *aFltTOX.GetBase()); @@ -3410,7 +3410,7 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, OUString& rStr ) } // Set end in stack - m_pReffedStck->SetAttr( *pPos, RES_FLTR_TOX ); + m_xReffedStck->SetAttr( *pPos, RES_FLTR_TOX ); if (!m_aApos.back()) //a para end in apo doesn't count m_bWasParaEnd = true; @@ -3471,7 +3471,7 @@ eF_ResT SwWW8ImplReader::Read_F_Hyperlink( WW8FieldDesc* /*pF*/, OUString& rStr { sMark = EnsureTOCBookmarkName(sMark); // track <sMark> as referenced TOC bookmark. - m_pReffedStck->aReferencedTOCBookmarks.insert( sMark ); + m_xReffedStck->aReferencedTOCBookmarks.insert( sMark ); } if (m_bLoadingTOXCache) |