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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Sep 2 19:32:40 UTC 2021


 sw/qa/core/data/ww8/pass/ofz38011-1.doc |binary
 sw/source/filter/ww8/ww8par2.cxx        |    9 +++++++++
 2 files changed, 9 insertions(+)

New commits:
commit bc7baa18435000f47f90e47d3300710bcb4cf56b
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Sep 2 13:35:34 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Sep 2 21:32:03 2021 +0200

    ofz#38011 save and restore m_pLastAnchorPos via UnoCursor
    
    when we do some operations that may delete paragraphs
    
    Change-Id: I2165dd287771f06c6d0fd061dd7659b06db4bd72
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121511
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/qa/core/data/ww8/pass/ofz38011-1.doc b/sw/qa/core/data/ww8/pass/ofz38011-1.doc
new file mode 100644
index 000000000000..8ef58ca5395d
Binary files /dev/null and b/sw/qa/core/data/ww8/pass/ofz38011-1.doc differ
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 074b908d213c..a431040a20c7 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -2755,8 +2755,17 @@ void WW8TabDesc::MoveOutsideTable()
 void WW8TabDesc::FinishSwTable()
 {
     m_pIo->m_xRedlineStack->closeall(*m_pIo->m_pPaM->GetPoint());
+
+    // ofz#38011 drop m_pLastAnchorPos during RedlineStack dtor and restore it afterwards to the same
+    // place, or somewhere close if that place got destroyed
+    std::shared_ptr<SwUnoCursor> xLastAnchorCursor(m_pIo->m_pLastAnchorPos ? m_pIo->m_rDoc.CreateUnoCursor(*m_pIo->m_pLastAnchorPos) : nullptr);
+    m_pIo->m_pLastAnchorPos.reset();
+
     m_pIo->m_xRedlineStack = std::move(mxOldRedlineStack);
 
+    if (xLastAnchorCursor)
+        m_pIo->m_pLastAnchorPos.reset(new SwPosition(*xLastAnchorCursor->GetPoint()));
+
     WW8DupProperties aDup(m_pIo->m_rDoc,m_pIo->m_xCtrlStck.get());
     m_pIo->m_xCtrlStck->SetAttr( *m_pIo->m_pPaM->GetPoint(), 0, false);
 


More information about the Libreoffice-commits mailing list