Details
-
Bug
-
Resolution: Incomplete
-
P1: Critical
-
None
-
5.15.2, 6.2.1
-
None
Description
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(); } }