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

Crash in QTextDocument::markContentsDirty when tried to mark code as dirty

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P1: Critical P1: Critical
    • 4.7.2
    • 4.7.1
    • GUI: Text handling
    • None
    • Reproduced on all platforms.
    • fd3fc0b34a891751e6a0849421e8cecd19481324

      The following code causes the crash on all platforms:

          QTextDocument doc(str);
          QTextCursor cursor(&doc);
          cursor.movePosition(QTextCursor::Down, QTextCursor::MoveAnchor, 1);
          QSignalSpy spy(&doc, SIGNAL(contentsChanged()));
          doc.markContentsDirty(cursor.position(), cursor.block().length());
      

      Crash is happened in QTextDocument::markContentsDirty method.

          d->documentChange(from, length);
          if (!d->inContentsChange) {
              d->lout->documentChanged(d->docChangeFrom, d->docChangeOldLength, d->docChangeLength);
              d->docChangeFrom = -1;
          }
      

      QAbstractTextDocumentLayout *lout variable is 0 by default.
      This code worked on 4.6.3. If this code is incorrect and layout should be always set before using QTextDocument we will have binary incompatibility between two Qt versions.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            jiang Jiang Jiang
            vasyura Oleh Vasyura
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes