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

REG 5->6: QVector size() does not reach capacity() before reallocating

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P1: Critical
    • None
    • 6.0, 6.1, 6.2
    • None

    Description

      This code regressed in Qt 6:

          QVector<int> v;
          v.resize(4);
          v.erase(v.begin());
          while (v.size() < v.capacity()) {
              v.push_back(0);
          }
      

      The while loop never terminates; the vector is reallocated too early, when size() == capacity() - 1, and keeps getting reallocated like that.

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-92941
          # Subject Branch Project Status CR V

          Activity

            People

              thiago Thiago Macieira
              peppe Giuseppe D'Angelo
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes