Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
Qt Creator 3.2.0-beta1
-
None
-
commit 900e6c94d10aeb886f0c2f89532dc99e6ac99b12
-
956744dff8bbc03bd9ce26eefc985d474b8330ca
Description
When you press Tab in the text editor for a commit, Creator enters an infinite loop.
Steps to reproduce:
- make a modification to any file
- start a commit (Tools > Git > Commit)
- press Tab
Creator enters an infiite loop at that point.
The loop is at:
src/plugins/vcsbase/submiteditorwidget.cpp:302ff
while (!cursor.atEnd()) { const QString block = cursor.block().text(); if (block.startsWith(QLatin1Char('\t'))) { // Don't wrap rc += block + newLine; } else { forever { cursor.select(QTextCursor::LineUnderCursor); rc += cursor.selectedText(); rc += newLine; cursor.movePosition(QTextCursor::EndOfLine); // Mac needs it if (cursor.atBlockEnd()) break; cursor.movePosition(QTextCursor::NextCharacter); } } cursor.movePosition(QTextCursor::NextBlock); }
cursor.atEnd() is false, so the loop never exits. block.startsWith(QLatin1Char('\t')) is true, so the block is simply added to rc. Then cursor.movePosition(QTextCursor::NextBlock) returns false, since there is no next block.