[Libreoffice-commits] core.git: sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Feb 22 13:35:03 UTC 2019


 sw/source/filter/basflt/fltshell.cxx |    6 ++----
 sw/source/filter/inc/fltshell.hxx    |    4 ++--
 sw/source/filter/ww8/ww8par5.cxx     |    2 +-
 3 files changed, 5 insertions(+), 7 deletions(-)

New commits:
commit 70c3d1a25a0ace873ce7fa4b49af416f8fa6f1ff
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Feb 22 11:40:13 2019 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Feb 22 14:34:31 2019 +0100

    ofz#13250 Direct-leak
    
    Change-Id: Idf5984399f2d8bdf4751667e01f170bed15a4443
    Reviewed-on: https://gerrit.libreoffice.org/68205
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

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;


More information about the Libreoffice-commits mailing list