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

"del view" in PySide2 QML applications should not be necessary

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Out of scope
    • Icon: Not Evaluated Not Evaluated
    • None
    • 5.15.1
    • Documentation, PySide
    • None

      There is a lot of QML code examples with `del view`, for example https://doc.qt.io/qtforpython/tutorials/qmlapp/qmlapplication.html or https://code.qt.io/cgit/pyside/pyside-setup.git/tree/examples/declarative/extending/chapter2-methods/methods.py#n103 

      I don't understand the reason for this at all. The comment "Deleting the view before it goes out of scope is required to make sure all child QML instances are destroyed in the correct order." is more confusing than helping. As far as I understand the Python garbage collector, letting the variable going out of scope is actually the same as using the `del` statement. I tried a few examples (under Windows) commenting out the `del view` and nothing (bad) happens at exit.

      Is this really required for PySide2 QML applications? If yes, I would recommend getting rid of this requirement. `del` should only be used in the rarest cases (in Python) and should not be required for a default application.

      If this is not required (anymore) please clean up the code examples.

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

            kleint Friedemann Kleint
            schlamar schlamar
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes