Details
-
Bug
-
Resolution: Out of scope
-
Not Evaluated
-
None
-
5.15.1
-
None
Description
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.