I have a block of code that calls QTextCursor::insertFrame() and then adds some
formatted text to a QTextDocument. After repeated calls to insertFrame() there
is an assertion failure in QTextDocumentPrivate::insertFrame():
Q_ASSERT(end >= 0 && end < length());
The end and start arguments look good in the debugger, so the problem must be
with length(), which I can't see in the debugger. That function is defined in
qtextdocument_p.h:
inline int length() const { return fragments.length(); }
As this code has worked fine from 4.3.x through 4.5.0-beta1 it is suspicious
that one of the few changes in src/gui/text is in
QTextCopyHelper::appendFragment() in qtextdocumentfragment.cpp
122,123c122,127
< blockIdx = convertFormatIndex(nextBlock.blockFormat());
< dst->insertBlock(insertPos, blockIdx, charFormatIndex);
---
> // insert a new text block with the block and char format
> from the
> // source block to make sure that the following text fragments
> // end up in a list as they should
> int listBlockFormatIndex =
> convertFormatIndex(nextBlock.blockFormat());
> int listCharFormatIndex =
> convertFormatIndex(nextBlock.charFormat());
> dst->insertBlock(insertPos, listBlockFormatIndex,
> listCharFormatIndex);
_______________________________________________
Qt4-preview-feedback mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt4-preview-feedback