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

Displaying \x3 to QTextEdit leads to warning and later to crash

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • None
    • 6.5.1
    • None
    • Windows
    • f5206b381 (dev)

    Description

      When appending to QTextEdit a text with a \x" character, I get a qWarning and if I appdn the message itself to the same QTextEdit, I get a crash (reproting actualFontEngine is being accessed while null in QTextEngine::shapeText).

      #include <QApplication>
      #include <QDialog>
      #include <QTextEdit>
      #include <QVBoxLayout>
      
      static QTextEdit* edit = NULL;
      
      void MessageOutput( QtMsgType type, const QMessageLogContext &context, const QString &msg)
      {
          QString message = "[DEBUG] -- " + msg + "\n";
          edit->append(message.toStdString().c_str());
      }
      
      int main( int argc, char* argv[] )
      {
          QApplication app(argc, argv);
      
          qInstallMessageHandler(MessageOutput);
      
          QDialog dlg;
          dlg.setLayout( new QVBoxLayout );
          edit = new QTextEdit;
          edit->append( "(\"/0@\x3\\r\\n\")\n" );
          dlg.layout()->addWidget( edit );
          dlg.show();
      
          return app.exec();
      }
      

      There may be two issues:

      • Getting an unexpected warning
      • Crashing when append is called recurively?

      Any workaround (like a QTextEdit font setup/config) would be appreciated.

      Attachments

        For Gerrit Dashboard: QTBUG-113848
        # Subject Branch Project Status CR V

        Activity

          People

            axelspoerl Axel Spoerl
            jpo38 Jean Porcherot
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes