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

Details

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

    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

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

          Activity

            People

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

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes