[Qt4-preview-feedback] QTextCursor::insertFrame() Assertion Failure in 4.5.0-rc1
Franusich, Michael D.
franusmd at westinghouse.com
Sat Feb 7 20:56:29 CET 2009
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);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt4-feedback/attachments/20090207/b3c80d61/attachment.html
More information about the Qt4-feedback
mailing list