Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-25389

TextEdit crashes in setText after setting selection when switching between plain and rich text mode.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • 4.8.2
    • 4.8.1
    • None
    • This has been reproduced on ubuntu linux 11.10 with gcc 4.6.1 using
      qt-everywhere-opensource-src-4.8.1.zip compiled with ./configure --debug
      and the Qt 4.8.0 SDK
      and Windows 7 with mingw 4.6.1 using the QT 4.8.0 SDK

    Description

      A short example .qml file that triggers the bug when clicked is attached, it was run in a default Qt Quick UI project and also appears to crash in the QML viewer. There are 2 commented out lines, each of which prevents the bug from occuring if uncommented.

      Steps to reproduce:
      Set the textEdit with html formatted text.
      Call selectAll()
      Set the textEdit text to an empty string.
      Set the textEdit text with html formatted text - this line will crash, as preeditAreaText() has been called on a null textlayout.

      This doesn't occur if the textEdit is explicitly set to Text.RichText, or explicitly set to Text.PlainText.

      Stack trace:

      0	QTextLayout::preeditAreaText	qtextlayout.cpp	487	0x9be081	
      1	QDeclarativeTextEditPrivate::determineHorizontalAlignment	qdeclarativetextedit.cpp	551	0x28ed7d	
      2	QDeclarativeTextEdit::moveCursorDelegate	qdeclarativetextedit.cpp	1592	0x291e63	
      3	QDeclarativeTextEdit::qt_static_metacall	moc_qdeclarativetextedit_p.cpp	361	0x3f1fbf	
      4	QMetaObject::activate	qobject.cpp	3547	0x1422d45	
      5	QTextControl::microFocusChanged	moc_qtextcontrol_p.cpp	329	0x9abdbb	
      6	QTextControlPrivate::updateCurrentCharFormat	qtextcontrol.cpp	310	0x99dc64	
      7	QTextControlPrivate::_q_updateCurrentCharFormatAndSelection	qtextcontrol.cpp	603	0x99f0cf	
      8	QTextControl::qt_static_metacall	moc_qtextcontrol_p.cpp	163	0x9ab645	
      9	QMetaObject::activate	qobject.cpp	3547	0x1422d45	
      10	QTextDocument::contentsChanged	moc_qtextdocument.cpp	208	0xefa14f	
      11	QTextDocumentPrivate::contentsChanged	qtextdocument_p.cpp	1654	0x9f284a	
      12	QTextDocumentPrivate::finishEdit	qtextdocument_p.cpp	1246	0x9f0f1a	
      13	QTextDocumentPrivate::endEditBlock	qtextdocument_p.cpp	1201	0x9f0bfc	
      14	QTextDocument::setHtml	qtextdocument.cpp	1225	0x9dae86	
      15	QTextControlPrivate::setContent	qtextcontrol.cpp	478	0x99e818	
      16	QTextControl::setHtml	qtextcontrol.cpp	1163	0x9a1674	
      17	QDeclarativeTextEdit::setText	qdeclarativetextedit.cpp	257	0x28e237	
      18	QDeclarativeTextEdit::qt_metacall	moc_qdeclarativetextedit_p.cpp	450	0x3f25c7	
      19	QMetaObject::metacall	qmetaobject.cpp	245	0x140ee94	
      20	QDeclarativeVMEMetaObject::metaCall	qdeclarativevmemetaobject.cpp	623	0x2bd6a4	
      

      This also occured in version 4.8.0

      Attachments

        1. main.qml
          0.7 kB
          Matthew Elvey Price

        Activity

          People

            denexter Andrew den Exter (closed Nokia identity) (Inactive)
            matthewelveyprice Matthew Elvey Price
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: