summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2017-01-10 23:25:47 +0100
committerMichael Stahl <mstahl@redhat.com>2017-01-11 11:25:45 +0000
commiteeb0b8c5fcfcc24b05b773e921b04f3325991247 (patch)
tree1294a1c298ebbed1e0714a2bd85b420b8bb43d57
parent73316bbc92b264f84c68c96460e262a5dd6e0d04 (diff)
tdf#105077 sw: fix wrong assert corner-case in SwRegHistory::InsertItems
There is a tricky corner-case when an item set is inserted that contains items that are all identical to what's in the node's item set. In this case a SwHistorySetText will be created for an overwritten hint, but no new AUTOFMT hint will be inserted so there is no SwHistoryResetText. So it looks like AUTOFMT can't be checked at all here. (regression from b44e70e3d17c79eaf78f9bfe8bd0275d7ed9325f) Change-Id: I83a241588cef6a9ec074d4f0e39322987394ca86 (cherry picked from commit db4badfc971b9cc60809c3408f579bae04a77c34) Reviewed-on: https://gerrit.libreoffice.org/32942 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Jenkins <ci@libreoffice.org>
-rw-r--r--sw/source/core/undo/rolbck.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx
index a8cafba5a514..3e553387dfe0 100644
--- a/sw/source/core/undo/rolbck.cxx
+++ b/sw/source/core/undo/rolbck.cxx
@@ -1317,8 +1317,10 @@ bool SwRegHistory::InsertItems( const SfxItemSet& rSet,
(isCHRATR(nWhich) || RES_TXTATR_UNKNOWN_CONTAINER == nWhich)
? RES_TXTATR_AUTOFMT
: static_cast<RES_TXTATR>(nWhich));
- if (RES_TXTATR_AUTOFMT == nExpected && 0 == nStart && pTextNode->Len() == nEnd)
+ if (RES_TXTATR_AUTOFMT == nExpected)
continue; // special case, may get set on text node itself
+ // tdf#105077 even worse, node's set could cause
+ // nothing at all to be inserted
assert(std::find_if(
m_pHistory->m_SwpHstry.begin(), m_pHistory->m_SwpHstry.end(),
[nExpected](SwHistoryHint *const pHint) -> bool {