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

QVarLengthArray::push_back() is not strongly exception-safe

    XMLWordPrintable

Details

    • e297e80fd0ec6ce4c97ee1b40426c76377b45ecc (qt/qtbase/dev)

    Description

      There's really no reason for it not to be. But when I change the ctor argument in https://codereview.qt-project.org/c/qt/qtbase/+/385125/2/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp#413 to 2, the size() after the failed append() is 0.

      Looks like reallocate() greedily sets this->ptr to newPtr before moving stuff over. It should wait with the update of *this until the elements have successfully moved over.

      Attachments

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

        Activity

          People

            mmutz Marc Mutz
            mmutz Marc Mutz
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes