diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-06-15 12:41:14 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-06-15 12:44:10 +0100 |
commit | 03e750a73273239e238d8dd8f6f01aa59a8f6cca (patch) | |
tree | b7d8e6ddff4038b63f137b6e244de1acfbd93112 /sw | |
parent | d47719a7a8558db9502b84e3e64c4a1bb7af3e7c (diff) |
ofz: fix another leak
Change-Id: I488ee070ab781011e357db6858188d2b706cb348
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/ww8/ww8par2.hxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par6.cxx | 13 |
2 files changed, 7 insertions, 8 deletions
diff --git a/sw/source/filter/ww8/ww8par2.hxx b/sw/source/filter/ww8/ww8par2.hxx index d532a580634e..a097b62ba774 100644 --- a/sw/source/filter/ww8/ww8par2.hxx +++ b/sw/source/filter/ww8/ww8par2.hxx @@ -67,7 +67,7 @@ struct WW8SwFlyPara // part 2: changes found during reading long nNewNetWidth; - SwPosition* pMainTextPos; // to return to main text after apo + std::unique_ptr<SwPosition> xMainTextPos; // to return to main text after apo sal_uInt16 nLineSpace; // line space in tw for graf apos bool bAutoWidth; bool bToggelPos; diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 67282c3a1150..508245c17fc2 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -2399,7 +2399,7 @@ bool SwWW8ImplReader::StartApo(const ApoTestResults &rApo, const WW8_TablePos *p } // remember Pos in body text - m_xSFlyPara->pMainTextPos = new SwPosition( *m_pPaM->GetPoint() ); + m_xSFlyPara->xMainTextPos.reset(new SwPosition(*m_pPaM->GetPoint())); //remove fltanchors, otherwise they will be closed inside the //frame, which makes no sense, restore them after the frame is @@ -2488,9 +2488,9 @@ void SwWW8ImplReader::StopApo() } else { - if (!m_xSFlyPara->pMainTextPos) + if (!m_xSFlyPara->xMainTextPos) { - OSL_ENSURE( m_xSFlyPara->pMainTextPos, "StopApo: pMainTextPos is 0" ); + OSL_ENSURE(m_xSFlyPara->xMainTextPos.get(), "StopApo: xMainTextPos is nullptr"); return; } @@ -2511,7 +2511,7 @@ void SwWW8ImplReader::StopApo() SwNodeIndex aPref(m_pPaM->GetPoint()->nNode, -1); SwTwips nNewWidth = - MoveOutsideFly(m_xSFlyPara->pFlyFormat, *m_xSFlyPara->pMainTextPos); + MoveOutsideFly(m_xSFlyPara->pFlyFormat, *m_xSFlyPara->xMainTextPos); if (nNewWidth) m_xSFlyPara->BoxUpWidth(nNewWidth); @@ -2584,7 +2584,7 @@ void SwWW8ImplReader::StopApo() aFlySet.ClearItem(RES_FRM_SIZE); - CalculateFlySize(aFlySet, m_xSFlyPara->pMainTextPos->nNode, + CalculateFlySize(aFlySet, m_xSFlyPara->xMainTextPos->nNode, m_xSFlyPara->nWidth); nNewWidth = ItemGet<SwFormatFrameSize>(aFlySet, RES_FRM_SIZE).GetWidth(); @@ -2595,8 +2595,7 @@ void SwWW8ImplReader::StopApo() m_xSFlyPara->pFlyFormat->SetFormatAttr(aSize); } - delete m_xSFlyPara->pMainTextPos; - m_xSFlyPara->pMainTextPos = nullptr; + m_xSFlyPara->xMainTextPos.reset(); // To create the SwFrames when inserting into an existing document, fltshell.cxx // will call pFlyFrame->MakeFrames() when setting the FltAnchor attribute |