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

[REG] QVarLengthArray::resize() does not initalize the new elements when it is called

    XMLWordPrintable

Details

    • fbb600a7a92b60b388406fecf2d8a94f0d4f5586

    Description

      QVarLengthArray::resize() does not initalize the new elements when it is called, the following will output false for the first debug and then crash when it tries to assign 2 to the variant:

      #include <QtCore>
      
      int main(int argc, char **argv)
      {
          QCoreApplication ca(argc, argv);
          QVarLengthArray<QVariant,1> values(1);
          values[0] = 1;
          values.resize(2);
          qDebug() << (values[1] == QVariant());
          values[1] = 2;
          qDebug() << (values[1] == 2);
          return 0;
      }
      

      Attachments

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

        Activity

          People

            goffart Olivier Goffart (closed Nokia identity) (Inactive)
            anshaw Andy Shaw (closed Nokia identity) (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes