Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.15.2
-
None
Description
When installing a native event filter like this:
qapp.installNativeEventFilter(WindowsRestartManager())
No events are received (but also no exception or error message or warning). This is fixed by changing it to this:
rm = WindowsRestartManager() qapp.installNativeEventFilter(rm)
(where WindowsRestartManager is an implementation of QAbstractNativeEventFilter).
Presumably PySide fails to increase the ref count so the instance get garbage collected (but then I'd expect the program to crash or throw an exception...)?
Ideally this would be fixed, less ideally documented at https://doc.qt.io/qtforpython-5/PySide2/QtCore/QCoreApplication.html#PySide2.QtCore.PySide2.QtCore.QCoreApplication.installNativeEventFilter. (Also, that page wrongly says that nativeEventFilter should return True or False, when actually it should return a Tuple[bool, int] as far as I understand.)
Attachments
Issue Links
- relates to
-
PYSIDE-1807 QObject.installEventFilter() should prevent gc for the installed object
- Reported