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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sat Sep 25 20:31:32 UTC 2021


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

New commits:
commit ca844cbdc3e933e3082e9cde0632445916de819e
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Sep 25 19:57:36 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat Sep 25 22:30:58 2021 +0200

    ofz#39252 use safer SwUnoCursor for the pos to move back to
    
    Change-Id: Iba6f200cea92196986bd30564cf56ab5d8b954b1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122611
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 3f8fbb67d47b..4045a3a5eda9 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -1984,7 +1984,7 @@ void SwWW8ImplReader::ImportDopTypography(const WW8DopTypography &rTypo)
  * Footnotes and Endnotes
  */
 WW8ReaderSave::WW8ReaderSave(SwWW8ImplReader* pRdr ,WW8_CP nStartCp) :
-    maTmpPos(*pRdr->m_pPaM->GetPoint()),
+    mxTmpPos(pRdr->m_rDoc.CreateUnoCursor(*pRdr->m_pPaM->GetPoint())),
     mxOldStck(std::move(pRdr->m_xCtrlStck)),
     mxOldAnchorStck(std::move(pRdr->m_xAnchorStck)),
     mxOldRedlines(std::move(pRdr->m_xRedlineStack)),
@@ -2081,7 +2081,7 @@ void WW8ReaderSave::Restore( SwWW8ImplReader* pRdr )
     pRdr->DeleteAnchorStack();
     pRdr->m_xAnchorStck = std::move(mxOldAnchorStck);
 
-    *pRdr->m_pPaM->GetPoint() = maTmpPos;
+    *pRdr->m_pPaM->GetPoint() = GetStartPos();
 
     if (mxOldPlcxMan != pRdr->m_xPlcxMan)
         pRdr->m_xPlcxMan = mxOldPlcxMan;
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index ffab6636f377..3d640b8485de 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -589,7 +589,7 @@ class WW8ReaderSave
 {
 private:
     WW8PLCFxSaveAll maPLCFxSave;
-    SwPosition maTmpPos;
+    std::shared_ptr<SwUnoCursor> mxTmpPos;
     std::deque<bool> maOldApos;
     std::deque<WW8FieldEntry> maOldFieldStack;
     std::unique_ptr<SwWW8FltControlStack> mxOldStck;
@@ -617,7 +617,7 @@ private:
 public:
     WW8ReaderSave(SwWW8ImplReader* pRdr, WW8_CP nStart=-1);
     void Restore(SwWW8ImplReader* pRdr);
-    const SwPosition &GetStartPos() const { return maTmpPos; }
+    const SwPosition &GetStartPos() const { return *mxTmpPos->GetPoint(); }
 };
 
 enum class eF_ResT { OK, TEXT, TAGIGN, READ_FSPA };


More information about the Libreoffice-commits mailing list