[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Aug 7 15:25:18 UTC 2018


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

New commits:
commit 71aae473c9c3cf15f75e2722afc7153a3af76d44
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Aug 2 21:18:15 2018 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Aug 7 17:24:59 2018 +0200

    forcepoint#69 ditch any unclosed m_pPosAfterTOC before dropping cursor
    
    Change-Id: I6b56a48f5449b25fe3bdc2e02d3885388b0da74f
    Reviewed-on: https://gerrit.libreoffice.org/58498
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 5aebb80ee873..1d0213f58347 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -5410,6 +5410,7 @@ ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary const *pGloss)
 
     SAL_WARN_IF(m_pTableEndPaM, "sw.ww8", "document ended without table ending");
     m_pTableEndPaM.reset();  //ensure this is deleted before pPaM
+    m_pPosAfterTOC.reset();
     mpCursor.reset();
     m_pPaM = nullptr;
     m_pLastAnchorPos.reset();//ensure this is deleted before UpdatePageDescs
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 11e53a5a9a05..c0a4b44c4c93 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -1355,7 +1355,7 @@ private:
     // Indicate that current on loading a hyperlink, which is inside a TOC; Managed by Read_F_Hyperlink() and End_Field()
     bool m_bLoadingTOXHyperlink;
     // a document position recorded the after-position of TOC section, managed by Read_F_TOX() and End_Field()
-    SwPaM* m_pPosAfterTOC;
+    std::unique_ptr<SwPaM> m_pPosAfterTOC;
     // used for some dropcap tweaking
     SwTextNode* m_pPreviousNode;
 
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index e6dee54d5d50..c599aa59e2d1 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -567,8 +567,7 @@ sal_uInt16 SwWW8ImplReader::End_Field()
                         if (m_pPosAfterTOC)
                         {
                             *m_pPaM = *m_pPosAfterTOC;
-                            delete m_pPosAfterTOC;
-                            m_pPosAfterTOC = nullptr;
+                            m_pPosAfterTOC.reset();
                         }
                     }
                 }
@@ -3382,8 +3381,7 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, OUString& rStr )
 
     //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;
-    delete m_pPosAfterTOC;
-    m_pPosAfterTOC = new SwPaM(*m_pPaM, m_pPaM);
+    m_pPosAfterTOC.reset(new SwPaM(*m_pPaM, m_pPaM));
     (*m_pPaM).Move(fnMoveBackward);
     SwPaM aRegion(*m_pPaM, m_pPaM);
 


More information about the Libreoffice-commits mailing list