Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-1407

Memory leak / reference counting error with destroyed objects from qmlRegisterType

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • Some future version
    • 5.12.6, 5.15.1, 6.0.0
    • PySide, Shiboken
    • None
    • Windows

    Description

      When a Python QML type registered with qmlRegisterType gets destroyed in the QML context (e.g. by using a loader), the Python object is not getting garbage collected.

      I have attached a minimal example. To reproduce hit the "Toggle" button three times. At this point there are two objects in the WeakSet, but one of these objects were already deleted at the second toggle click (destroyed signal was emitted).

      You can see in the output from objgraph, that the Python object has only 2 strong references in the current frame (and none other in Python), but the refcount is 5. So there has to be some some ref counting errors in C++ / shiboken.

      Tested on Windows, but other platforms are probably affected, too.

      Attachments

        1. main.py
          1 kB
        2. type.qml
          0.1 kB
        3. view.qml
          0.4 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            ctismer Christian Tismer
            schlamar schlamar
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes