summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2016-10-04 17:21:33 +0200
committerMichael Stahl <mstahl@redhat.com>2016-10-04 17:53:27 +0200
commit76a5c7138361d8fc6493638d6c5a882e0a891bb0 (patch)
tree8f9b2bc0f0c1c26a97375d008cd35e4cf08dc1ae
parent92664a81aea6c150e219a1cf4b9a98d27cdd547b (diff)
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
-rw-r--r--sw/source/core/doc/docbm.cxx10
1 files changed, 9 insertions, 1 deletions
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 5d7549695181..25f6b8070a63 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();
}