Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaime Resano <Jaime.Resano-Aisa@qt.io>2024-11-22 15:51:18 +0100
committerJaime Resano <Jaime.RESANO-AISA@qt.io>2024-11-25 11:11:46 +0000
commit4274aaed897e713fc628e4dcec93ac6a5f704af0 (patch)
treed19345c8d515988857fb78a3f6d203b00cd23a1f /examples/quickcontrols
parent78ac4b40a5da489036885def98e5108fdd56cdbc (diff)
Delete QQmlApplicationEngine on application exit
Due to the API limitations, we have to ensure that the engine is deleted before other parts of the application is deleted. Otherwise exposing objects using setInitialProperties() or setContextProperty() for example will cause warnings to be printed. It is a good practice to always delete the engine manually so all the code should be consistent. Task-number: PYSIDE-1612 Pick-to: 6.8 Change-Id: I01f16359e9d90cefd5957708fe12ce489bd7edc0 Reviewed-by: Jaime Resano <Jaime.RESANO-AISA@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'examples/quickcontrols')
-rw-r--r--examples/quickcontrols/contactslist/main.py4
-rw-r--r--examples/quickcontrols/filesystemexplorer/main.py4
-rw-r--r--examples/quickcontrols/gallery/gallery.py4
3 files changed, 8 insertions, 4 deletions
diff --git a/examples/quickcontrols/contactslist/main.py b/examples/quickcontrols/contactslist/main.py
index 41c7142b3..c9ce11e51 100644
--- a/examples/quickcontrols/contactslist/main.py
+++ b/examples/quickcontrols/contactslist/main.py
@@ -24,6 +24,6 @@ if __name__ == '__main__':
if not engine.rootObjects():
sys.exit(-1)
- ex = app.exec()
+ exit_code = app.exec()
del engine
- sys.exit(ex)
+ sys.exit(exit_code)
diff --git a/examples/quickcontrols/filesystemexplorer/main.py b/examples/quickcontrols/filesystemexplorer/main.py
index 97bf9852d..9c63ec385 100644
--- a/examples/quickcontrols/filesystemexplorer/main.py
+++ b/examples/quickcontrols/filesystemexplorer/main.py
@@ -46,4 +46,6 @@ if __name__ == '__main__':
fsm = engine.singletonInstance("FileSystemModule", "FileSystemModel")
fsm.setInitialDirectory(args[0])
- sys.exit(app.exec())
+ exit_code = app.exec()
+ del engine
+ sys.exit(exit_code)
diff --git a/examples/quickcontrols/gallery/gallery.py b/examples/quickcontrols/gallery/gallery.py
index 7e93e083c..d454cf53e 100644
--- a/examples/quickcontrols/gallery/gallery.py
+++ b/examples/quickcontrols/gallery/gallery.py
@@ -50,4 +50,6 @@ if __name__ == "__main__":
window = rootObjects[0]
window.setIcon(QIcon(':/qt-project.org/logos/pysidelogo.png'))
- sys.exit(app.exec())
+ exit_code = app.exec()
+ del engine
+ sys.exit(exit_code)