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

QDeclarativeEngine object ownership issues

XMLWordPrintable

      Object ownership does not seem to work the way it is described in the docs. I am trying to use a factory class written in C++ which is called from QML and returns new objects. As described at http://doc.qt.nokia.com/4.7/qdeclarativeengine.html#ObjectOwnership-enum if the new objects do not have a parent this should mean they are given JavaScript ownership and are deleted by the garbage collector. Attached is a set of test cases which demonstrate what I'm trying to do. When I run these tests what I get is:

      1) If the factory method does not return a QObject *, the reported ownership is QDeclarativeEngine::CppOwnership.
      2) Even when it is reported as QDeclarativeEngine::JavaScriptOwnership, the object does not get deleted by the engine, which would be expected.

        1. qmltest.cpp
          3 kB
          Daniel Milburn
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            aakenned Aaron Kennedy
            dmilburn Daniel Milburn
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes