summaryrefslogtreecommitdiff
path: root/sw/source/core/txtnode
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-01-21 11:12:34 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-01-21 15:36:18 +0000
commit2ab8f8e2baaeaa57068942ec6844e3033e5f2966 (patch)
tree9ce078d6caf744c7f51bd10679267219400728b7 /sw/source/core/txtnode
parenta6440c4f785aa5f29b3af409cd0d8fa198198d72 (diff)
sw: fix bogus assert in SwTxtNode::RstTxtAttr()
The assert for case 3 is wrong and fires when importing ooo44732-2.doc but there is also a bug here where a hint could be skipped. Change-Id: I028d2d5df9e80cf0001d9bc11aa7fabcd01e83bb (cherry picked from commit 01d25c96db366de003e4570ddf8559da3dd9ea5b) Reviewed-on: https://gerrit.libreoffice.org/14072 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source/core/txtnode')
-rw-r--r--sw/source/core/txtnode/txtedt.cxx19
1 files changed, 13 insertions, 6 deletions
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index 58164c668e17..55b5c9100206 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -529,6 +529,7 @@ void SwTxtNode::RstTxtAttr(
}
else // Case: 3
{
+ bChanged = true;
m_pSwpHints->NoteInHistory( pHt );
// UGLY: this may temporarily destroy the sorting!
pHt->GetStart() = nEnd;
@@ -539,13 +540,19 @@ void SwTxtNode::RstTxtAttr(
SwTxtAttr* pNew = MakeTxtAttr( *GetDoc(),
*pStyleHandle, nAttrStart, nEnd );
InsertHint( pNew, nsSetAttrMode::SETATTR_NOHINTADJUST );
- }
-
- // this case appears to rely on InsertHint not re-sorting
- // and pNew being inserted behind pHt
- assert(pHt == m_pSwpHints->GetTextHint(i));
- bChanged = true;
+ // skip the ++i because InsertHint will re-sort
+ // so now an unrelated hint (previous i+1) may be at i!
+ // (but pHt and pNew can only move to indexes >= i)
+#if OSL_DEBUG_LEVEL > 0
+ for (size_t j = 0; j < i; ++j)
+ {
+ assert(m_pSwpHints->GetTextHint(j) != pHt);
+ assert(m_pSwpHints->GetTextHint(j) != pNew);
+ }
+#endif
+ continue;
+ }
}
}
}