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

"Cannot read property ... of null" when exiting QML app - QmlElement object lifetime

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • 6.5.2
    • PySide
    • None

    Description

      When instantiating a QML element implemented in Python, the object lifetime is shorter than the object lifetime of QML elements defined in C++ or QML leading to `Cannot read property ... of null` errors on application exit.

       

      I've attached 2 minimal examples, one using PySide6 and one using Qt/C++ to demonstrate the problem. The PySide6 example throws the error `main.qml:23: TypeError: Cannot read property 'foo' of null` on application exit, where the C++ application just works.

       

      A workaround is to use defensive coding strategies e.g. nullish coalescing and optional chaining, but that adds unnecessary code compared to the C++ implementation.

      Attachments

        Issue Links

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

          Activity

            People

              crmaurei Cristian Maureira-Fredes
              machinekoder Alex Roessler
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes