I have not really understood this error, but i hunted it down to the function setUpIterator and made a quick fix that seems to work for me. The problem is that the static object staticLineBreakIterator is left with a pointer to the last examined string even after the string is deleted. That is why I only had that error when opening a second web page after closing a first one.
The quick fix in TextBreakIteratorQt.cpp is:
TextBreakIterator* setUpIterator(TextBreakIterator& iterator, QTextBoundaryFinder::BoundaryType type, const UChar* string, int length)
{
if (!string || !length)
return 0;
if (iterator.isValid() && type == iterator.type() && length == iterator.length
&& string == iterator.string
&& memcmp(string, iterator.string, length) == 0)
{
iterator.toStart();
return &iterator;
}
iterator = TextBreakIterator(type, string, length);
return &iterator;
}
TextBreakIterator* setUpIterator(TextBreakIterator& iterator, QTextBoundaryFinder::BoundaryType type, const UChar* string, int length)
{
if (!string || !length)
return 0;
if (iterator.isValid() && type == iterator.type() && length == iterator.length
&& string == iterator.string
&& memcmp(string, iterator.string, length) == 0)
{
iterator.toStart();
return &iterator;
}
iterator = TextBreakIterator(type, string, length);
return &iterator;
}
To copy to clipboard, switch view to plain text mode
The additional comparison in line 7 ensures that memcpy is only called if the new string is exactly the last examined. Maybe the memcpy can be omitted.
Bookmarks