Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-1737

QCoreApplication::installNativeEventFilter doesn't keep a reference to the event filter

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 5.15.2
    • PySide
    • None
    • Windows

      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.)

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            crmaurei Cristian Maureira-Fredes
            vashekcz Vaclav Dvorak
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes