Fix TextPagePrivate::removeSpace iteration

You need to use the iterator returned by erase
remotes/origin/textfind-and-transparency
Albert Astals Cid 15 years ago
parent ccc317bc5c
commit d0d2b45a11
  1. 9
      core/textpage.cpp

@ -1093,13 +1093,18 @@ void TextPagePrivate::removeSpace()
const QString str(' ');
it = m_words.begin(), itEnd = m_words.end();
for( ; it != itEnd ; it++)
while ( it != itEnd )
{
if((*it)->text() == str)
{
// create new Entity, otherwise there might be possible memory leakage
m_spaces.append( new TinyTextEntity( (*it)->text(),(*it)->area ) );
m_words.erase(it);
delete *it;
it = m_words.erase(it);
}
else
{
++it;
}
}
}

Loading…
Cancel
Save