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

void QObject::addChild(std::unique_ptr<QObject>)

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • None
    • Core: Object Model
    • None

    Description

      The `child->setParent(parent)` behavior is an implicit ownership transfer. Adding `void QObject::addChild(std::unique_ptr<QObject> child) { if (child)

      { child->setParent(this); child.release(); }

      }` would make this transfer explicit and much easier to be exception-safe. 

      Attachments

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

        Activity

          People

            vhilshei Volker Hilsheimer
            BenFrantzDale Benjamin FrantzDale
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes