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

sw_redlinehide_2: fix infinite loop caused by SwAttrIter::Seek(0)

The problem is if there is a delete redline that deletes the entire
pFirstNode and ends in a different node, at the position where a
hint starts; first m_pRedline->Seek() will be called with the wrong
node, then the GetNextAttr() will call MapModelToView() and get 0
back again...

Change-Id: Ie3eb1250267429ea3e3f6281685c955a79d4e960
üst 66b563cf
...@@ -340,13 +340,16 @@ bool SwAttrIter::Seek(TextFrameIndex const nNewPos) ...@@ -340,13 +340,16 @@ bool SwAttrIter::Seek(TextFrameIndex const nNewPos)
assert(m_pRedline); assert(m_pRedline);
} }
if (!nNewPos || newPos.second < m_nPosition) // sw_redlinehide: Seek(0) must move before the first character, which
// has a special case where the first node starts with delete redline.
if ((!nNewPos && (!m_pMergedPara || newPos.first != m_pTextNode))
|| newPos.second < m_nPosition)
{ {
if (m_pMergedPara) if (m_pMergedPara)
{ {
if (m_pTextNode != m_pMergedPara->pFirstNode) if (m_pTextNode != newPos.first)
{ {
m_pTextNode = m_pMergedPara->pFirstNode; m_pTextNode = newPos.first;
// sw_redlinehide: hope it's okay to use the current text node // sw_redlinehide: hope it's okay to use the current text node
// here; the AttrHandler shouldn't care about non-char items // here; the AttrHandler shouldn't care about non-char items
InitFontAndAttrHandler(*m_pTextNode, m_pMergedPara->mergedText, nullptr); InitFontAndAttrHandler(*m_pTextNode, m_pMergedPara->mergedText, nullptr);
...@@ -410,7 +413,7 @@ bool SwAttrIter::Seek(TextFrameIndex const nNewPos) ...@@ -410,7 +413,7 @@ bool SwAttrIter::Seek(TextFrameIndex const nNewPos)
m_pFont->SetActual( m_pScriptInfo->WhichFont(nNewPos) ); m_pFont->SetActual( m_pScriptInfo->WhichFont(nNewPos) );
if( m_pRedline ) if( m_pRedline )
m_nChgCnt = m_nChgCnt + m_pRedline->Seek(*m_pFont, newPos.first->GetIndex(), newPos.second, m_nPosition); m_nChgCnt = m_nChgCnt + m_pRedline->Seek(*m_pFont, m_pTextNode->GetIndex(), newPos.second, m_nPosition);
m_nPosition = newPos.second; m_nPosition = newPos.second;
if( m_nPropFont ) if( m_nPropFont )
......
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