Kaydet (Commit) db4badfc authored tarafından Michael Stahl's avatar Michael Stahl

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 b44e70e3)

Change-Id: I83a241588cef6a9ec074d4f0e39322987394ca86
üst ebadc601
...@@ -1317,8 +1317,10 @@ bool SwRegHistory::InsertItems( const SfxItemSet& rSet, ...@@ -1317,8 +1317,10 @@ bool SwRegHistory::InsertItems( const SfxItemSet& rSet,
(isCHRATR(nWhich) || RES_TXTATR_UNKNOWN_CONTAINER == nWhich) (isCHRATR(nWhich) || RES_TXTATR_UNKNOWN_CONTAINER == nWhich)
? RES_TXTATR_AUTOFMT ? RES_TXTATR_AUTOFMT
: static_cast<RES_TXTATR>(nWhich)); : 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 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( assert(std::find_if(
m_pHistory->m_SwpHstry.begin(), m_pHistory->m_SwpHstry.end(), m_pHistory->m_SwpHstry.begin(), m_pHistory->m_SwpHstry.end(),
[nExpected](SwHistoryHint *const pHint) -> bool { [nExpected](SwHistoryHint *const pHint) -> bool {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment