deleteLater() releases Python wrapper immediately (allowing it to be garbage collected), rather than during actual destruction
Lukas Lang
lukaslang.bugtracker at outlook.com
Sun Sep 6 14:38:06 BST 2026
I have run into an unexpected lifetime issue regarding the Python wrappers for QObjects: It seems that after calling .deleteLater, the Python wrapper object is no longer kept alive by pyQt, potentially causing it to be GC'ed before the underlying QObject is actually destroyed. This has several consequences, such as:
* Overrides/customizations (such as reimplementations of virtual functions) are lost, while the underlying QObject is still alive
* Any Python objects only reachable through the wrapper may also be GC'ed before destruction. If those objects are receivers for signals of the QObject, the associated slots are not called anymore after the Python objects are GC'ed
Seeing as this has several unexpected consequences, it seems like a bug to me?
Versions: Python 3.14.7, PyQt 6.11.0, Qt 6.11.0, sip 6.16.0
Best regards,
Lukas
(Note: I'm re-sending this because something seems to have gone wrong last time)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20260906/176e29d3/attachment.htm>
More information about the PyQt
mailing list