sw/source/core/doc/docbm.cxx |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 76a5c7138361d8fc6493638d6c5a882e0a891bb0
Author: Michael Stahl <mst...@redhat.com>
Date:   Tue Oct 4 17:21:33 2016 +0200

    sw: fix assert in MarkManager::deleteMarks()
    
    On loading tdf89405-1.odt there is a "DdeLink" bookmark and a range
    annotation at the same position:
    
    info:sw.core:17729:1:sw/source/core/doc/docbm.cxx:290: N2sw4mark8BookmarkE 
__DdeLink__30_388680695 11,11 11,52
    info:sw.core:17729:1:sw/source/core/doc/docbm.cxx:290: N2sw4mark7UnoMarkE 
__UnoMark__16_673019520 11,11 11,11
    info:sw.core:17729:1:sw/source/core/doc/docbm.cxx:290: N2sw4mark7UnoMarkE 
__UnoMark__19_673019520 11,12 11,12
    
    While deleting the annotation's field character at 11,11-11,12 the
    DdeLink one is moved but the UnoMarks are special-cased and remain where
    they are, so just do some more sorting in this case.
    
    Change-Id: If077329bf675cdf8dd788cc145252a078aba3750

diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 5d75496..25f6b80 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -674,6 +674,8 @@ namespace sw { namespace mark
 
         // boolean indicating, if at least one mark has been moved while 
collecting marks for deletion
         bool bMarksMoved = false;
+        // have marks in the range been skipped instead of deleted
+        bool bMarksSkipDeletion = false;
 
         // copy all bookmarks in the move area to a vector storing all 
position data as offset
         // reassignment is performed after the move
@@ -748,6 +750,10 @@ namespace sw { namespace mark
                     }
                     vMarksToDelete.push_back(ppMark);
                 }
+                else
+                {
+                    bMarksSkipDeletion = true;
+                }
             }
             else if ( bIsPosInRange != bIsOtherPosInRange )
             {
@@ -826,7 +832,9 @@ namespace sw { namespace mark
             }
         } // scope to kill vDelay
 
-        if ( bIsSortingNeeded )
+        // also need to sort if both marks were moved and not-deleted because
+        // the not-deleted marks could be in wrong order vs. the moved ones
+        if (bIsSortingNeeded || (bMarksMoved && bMarksSkipDeletion))
         {
             sortMarks();
         }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to