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

QTextCursor::beginEditBlock() crash after replacing text with shorter text

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P1: Critical P1: Critical
    • None
    • 5.4.0 Beta
    • GUI: Text handling
    • None
    • Macintosh OS X 10.9.5, Qt 5.4 recent stable branch checkout
      Windows 8.1, same Qt 5.4

      The sequence is:

      QTextCursor::beginEditBlock()
      a loop to find text and replace with shorter text
      QTextCursor::endEditBlock()
      QPlainTextEdit::setTextCursor() <=== CRASH

      Build the attached project with Qt 5.4. Click the Crash button, and it crashes on an assert:
      ASSERT failure in QVector<T>::operator[]: "index out of range", file ../../include/QtCore/../../../../../qt/qtbase/src/corelib/tools/qvector.h, line 396

      If you remove the call to QTextCursor::beginEditBlock(), the crash doesn't happen.

      Replacing text with longer text, no crash.

      Build with Qt 4.8.6, works as expected

      Crashes on both Macintosh and Windows

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

            esabraha Eskil Abrahamsen Blomfeldt
            johnweeks John Weeks
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes