diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-03-26 11:36:27 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-04-12 14:08:03 +0200 |
commit | 7c3beafa968280a66a7c554d9e979e17e903cb37 (patch) | |
tree | 7595d12a9b54e5fac60a54faad43debfea006318 /sources/pyside6/PySide6/QtWidgets | |
parent | 152ec44d1c0ac3da91bc6018f8c039e599f60df3 (diff) |
Release dialogs when using QDialog.exec()
In the typical pattern ported from C++
dialog = QDialog(mainWin)
dialog.exec()
one would expected the dialog to be deleted. However,
due to the constructor heuristics creating a parent-child
relationship, the dialog leaks. Add a modification
to remove the relationship in case exec() is called.
Change-Id: Ibc6f8c150cbd80a4085af4a5b713ee7c2c62abf3
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Diffstat (limited to 'sources/pyside6/PySide6/QtWidgets')
-rw-r--r-- | sources/pyside6/PySide6/QtWidgets/typesystem_widgets_common.xml | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sources/pyside6/PySide6/QtWidgets/typesystem_widgets_common.xml b/sources/pyside6/PySide6/QtWidgets/typesystem_widgets_common.xml index 6b4ce7bbe..0669c18f6 100644 --- a/sources/pyside6/PySide6/QtWidgets/typesystem_widgets_common.xml +++ b/sources/pyside6/PySide6/QtWidgets/typesystem_widgets_common.xml @@ -491,7 +491,9 @@ <object-type name="QDateEdit"/> <object-type name="QDialog"> <enum-type name="DialogCode" python-type="IntEnum"/> - <modify-function signature="exec()" allow-thread="yes"/> + <modify-function signature="exec()" allow-thread="yes"> + <inject-code file="../glue/qtwidgets.cpp" snippet="qdialog-exec-remove-parent-relation"/> + </modify-function> <add-function signature="exec_()" return-type="int"> <inject-code file="../glue/qtwidgets.cpp" snippet="qapplication-exec"/> </add-function> |