[Qt4-preview-feedback] QTextCursor::insertFrame() Assertion Failure in 4.5.0-rc1

Franusich, Michael D. franusmd at westinghouse.com
Sun Feb 8 18:05:13 CET 2009


The assertion failure happens under the following sequence:

QTextCursor::insertFrame()
QTextEditor::clear()
QTextCursor::insertFrame()

The following code will demonstrate this.  Replace MainWindow::newLetter() in
examples/mainwindows/docwidgets with this, build and run the example.  The
example application should run fine until you click the "New Letter" icon.
It should crash the first time you click it.

Multiple iterations work fine on 4.5.0-beta1, crashes under 4.5.0-rc1.

-----------------

void MainWindow::newLetter()
{
        textEdit->clear();

        QTextFrame *mainFrame = textEdit->textCursor().currentFrame();

        QTextFrameFormat frameFormat = mainFrame->frameFormat();

        for (int i = 1; i <= 3; i++) {

                textEdit->textCursor().insertFrame(frameFormat);

                textEdit->insertPlainText("Hello");

                textEdit->setTextCursor(mainFrame->lastCursorPosition());
        }
}




More information about the Qt4-feedback mailing list