Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-11614

VCS commit text editor infinite loop if block starts with Tab

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • Qt Creator 3.1.0-beta
    • 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:

      1. make a modification to any file
      2. start a commit (Tools > Git > Commit)
      3. 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.

      Attachments

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

        Activity

          People

            hunger Tobias Hunger
            thiago Thiago Macieira
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes