diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-02-22 11:40:13 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-02-22 14:34:31 +0100 |
commit | 70c3d1a25a0ace873ce7fa4b49af416f8fa6f1ff (patch) | |
tree | 8fd1a2196390778109a6d7337e42f802ac0cdf7d /sw | |
parent | d261d883b2149b37bdee739ee92bbea11b1fb7a1 (diff) |
ofz#13250 Direct-leak
Change-Id: Idf5984399f2d8bdf4751667e01f170bed15a4443
Reviewed-on: https://gerrit.libreoffice.org/68205
Tested-by: Jenkins
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/basflt/fltshell.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/inc/fltshell.hxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par5.cxx | 2 |
3 files changed, 5 insertions, 7 deletions
diff --git a/sw/source/filter/basflt/fltshell.cxx b/sw/source/filter/basflt/fltshell.cxx index 927efad68b98..a28cf6732597 100644 --- a/sw/source/filter/basflt/fltshell.cxx +++ b/sw/source/filter/basflt/fltshell.cxx @@ -739,8 +739,6 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, } } - delete pTOXAttr->GetBase(); - // set (above saved and removed) the break item at the node following the TOX if (pNd && aBkSet.Count()) pNd->SetAttr(aBkSet); @@ -1083,14 +1081,14 @@ const std::vector< std::pair<OUString, OUString> >& SwFltRDFMark::GetAttributes( // methods of SwFltTOX follow SwFltTOX::SwFltTOX(SwTOXBase* pBase) - : SfxPoolItem(RES_FLTR_TOX), pTOXBase(pBase), + : SfxPoolItem(RES_FLTR_TOX), m_xTOXBase(pBase), bHadBreakItem( false ), bHadPageDescItem( false ) { } bool SwFltTOX::operator==(const SfxPoolItem& rItem) const { - return pTOXBase == static_cast<const SwFltTOX&>(rItem).pTOXBase; + return m_xTOXBase.get() == static_cast<const SwFltTOX&>(rItem).m_xTOXBase.get(); } SfxPoolItem* SwFltTOX::Clone(SfxItemPool*) const diff --git a/sw/source/filter/inc/fltshell.hxx b/sw/source/filter/inc/fltshell.hxx index 7007a5ec1454..ae7fbe949ba0 100644 --- a/sw/source/filter/inc/fltshell.hxx +++ b/sw/source/filter/inc/fltshell.hxx @@ -290,7 +290,7 @@ public: class SW_DLLPUBLIC SwFltTOX : public SfxPoolItem { - SwTOXBase* const pTOXBase; + std::shared_ptr<SwTOXBase> m_xTOXBase; bool bHadBreakItem; // there was a break item BEFORE insertion of the TOX bool bHadPageDescItem; public: @@ -298,7 +298,7 @@ public: // "purely virtual methods" of SfxPoolItem virtual bool operator==(const SfxPoolItem&) const override; virtual SfxPoolItem* Clone(SfxItemPool* = nullptr) const override; - SwTOXBase* GetBase() { return pTOXBase; } + const SwTOXBase& GetBase() { return *m_xTOXBase; } void SetHadBreakItem( bool bVal ) { bHadBreakItem = bVal; } void SetHadPageDescItem( bool bVal ) { bHadPageDescItem = bVal; } bool HadBreakItem() const { return bHadBreakItem; } diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 953056a5a8f4..7858a11e183d 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -3395,7 +3395,7 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, OUString& rStr ) // Set start in stack m_xReffedStck->NewAttr( *pPos, aFltTOX ); - m_rDoc.InsertTableOf(*m_pPaM->GetPoint(), *aFltTOX.GetBase()); + m_rDoc.InsertTableOf(*m_pPaM->GetPoint(), aFltTOX.GetBase()); //The TOC field representation contents should be inserted into TOC section, but not after TOC section. //So we need update the document position when loading TOC representation and after loading TOC; |