sw/source/core/undo/rolbck.cxx |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 60ea01af8c57f9b03ee1da1196284fa10025c22c
Author:     Michael Stahl <michael.st...@cib.de>
AuthorDate: Fri Mar 1 18:24:40 2019 +0100
Commit:     Michael Stahl <michael.st...@cib.de>
CommitDate: Mon Mar 4 11:10:37 2019 +0100

    tdf#123313 sw: workaround Undo problem with ToX Update
    
    The problem is that when ToX is updated, CrossRefHeadingBookmarks will
    be created for the heading nodes, and SwUndoInsBookmark will be created
    at that time, but then nodes will be created for later entries in the
    ToX and if the heading is below the ToX then the node index in
    SwUndoInsBookmark will not match the node index of the
    CrossRefHeadingBookmark.
    
    Thus SwHistoryBookmark::IsEqualBookmark() will cause the mark to be
    skipped during Undo instead of deleted, and then it can cause trouble.
    
    Work around that by having SwHistoryBookmark::IsEqualBookmark() not
    check the position if it's a CrossRefHeadingBookmark.
    
    Change-Id: I9277978844837accdda35195a863c6163a839b6e
    Reviewed-on: https://gerrit.libreoffice.org/68596
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@cib.de>

diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx
index b8048539f459..51a4bcdd813f 100644
--- a/sw/source/core/undo/rolbck.cxx
+++ b/sw/source/core/undo/rolbck.cxx
@@ -54,6 +54,7 @@
 #include <charfmt.hxx>
 #include <strings.hrc>
 #include <bookmrk.hxx>
+#include <crossrefbookmark.hxx>
 #include <memory>
 
 OUString SwHistoryHint::GetDescription() const
@@ -669,9 +670,11 @@ void SwHistoryBookmark::SetInDoc( SwDoc* pDoc, bool )
 
 bool SwHistoryBookmark::IsEqualBookmark(const ::sw::mark::IMark& rBkmk)
 {
-    return m_nNode == rBkmk.GetMarkPos().nNode.GetIndex()
-        && m_nContent == rBkmk.GetMarkPos().nContent.GetIndex()
-        && m_aName == rBkmk.GetName();
+    return m_aName == rBkmk.GetName()
+        && (   (   m_nNode == rBkmk.GetMarkPos().nNode.GetIndex()
+                && m_nContent == rBkmk.GetMarkPos().nContent.GetIndex())
+            // tdf#123313 these are created in middle of ToX update
+            || dynamic_cast<sw::mark::CrossRefHeadingBookmark const*>(&rBkmk));
 }
 
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to