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

Pointers to C++ objects stored in non-var dynamic properties don't keep JS data alive

    XMLWordPrintable

Details

    Description

      Currently, holding a pointer / reference to a QObject from a non-var dynamic property doesn't result in a JS reference being generated. This can result in the JS data being collected by the GC if the object has QML ownership.

      Note that while this is expected behaviour (objects without CPP ownership, ie, a parent, are valid for the gc to clean up if there are no JS references to it) it is unusual behaviour since a reference from a var property will keep the object alive, whilst a reference from a variant (or Item) property will not.

      There are several dimensions to the problem:
      1) - reference generation is a moderately costly operation which is done once per JS engine gc().
      2) - changing the semantics of variant (and Item) properties may be unexpected to current users (eg QtQuick 1.0)
      3) + but having a difference between semantics of var and variant properties seems suboptimal
      4) + requiring the client to be aware of the difference between a C++ reference and a JS reference seems suboptimal.

      We are currently investigating what the possible cost of making a change like #19885 would be.
      Depending on the outcome, this bug may be rejected as invalid.

      Attachments

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

        Activity

          People

            chriadam Christopher Adams (closed Nokia identity) (Inactive)
            chriadam Christopher Adams (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes