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

QTextCursor movePosition(QTextCursor::End) --> QList assertion failes

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Incomplete
    • Icon: P1: Critical P1: Critical
    • None
    • 5.15.2, 6.2.1
    • GUI: Text handling
    • None
    • Windows

      Somehow movePosition(QTextCursor::End) gives an assertion problem on indices:

      Debug Error!Program: C:\Qt\6.2.1\msvc2019_64\bin\Qt6Cored.dll
      Module: 6.2.1
      File: C:\Users\qt\work\qt\qtbase\include\QtCore\../../src/corelib/tools/qlist.h
      Line: 398ASSERT failure in QList::at: "index out of range", file C:\Users\qt\work\qt\qtbase\include\QtCore\../../src/corelib/tools/qlist.h, line 398(Press Retry to debug the application)
      

      This only occurs when the application is run in debug mode. In release mode, the assertion is not raised.

      The following code change in my program works around this problem:

      void QMMWikiTextDoc::endTable()
      {
          if (_tables_cell.size() > 0) {
              QTextTable *table = _tables.back();
      
              _cursor = table->lastCursorPosition();
      
              //_cursor.movePosition(QTextCursor::End); // This gives an 'index out of range' (for a QList)
              QTextBlock blk = _doc->lastBlock();
              int blk_pos = blk.position();
              _cursor.setPosition(blk_pos);
      
              _tables_cell.pop_back();
              _tables_cells.pop_back();
              _tables.pop_back();
          }
      }
      

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

            vhilshei Volker Hilsheimer
            hansdijkema Hans Dijkema
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes