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

QVector: implicit sharing is broken

    XMLWordPrintable

Details

    • Linux/X11, macOS
    • 8abbbb4c482c32cd5342f5f8576cee8cbacc3737 (qt/qtbase/5.13)

    Description

      Calling QVector::fill() doesn't detach the copied vector from its source:

      #include <QVector>
      #include <QDebug>
      
      int main()
      {
          QVector<int> test = { 1, 2, 3 };
          QVector<int> copy = test;
          copy.fill(42);
      
          qWarning() << test;
      }
      

      Output:

      QVector(42, 42, 42)
      

      Valgrind doesn't report any issues.

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            jgrill Joachim Grill
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes