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

Signal connection of QObject attribute crashes if __eq__ is reimplemented

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • 5.15.2
    • PySide
    • None
    • Lubuntu 20.04
    • Linux/X11

    Description

      The minimal example that causes the crash follows:

        

      from PySide2.QtCore import QObject, Signal as QtSignal
      from PySide2.QtWidgets import QWidget, QApplication
      
      class QLoggerObject(QObject):
          filter_updated = QtSignal()
      
          def __init__(self, parent: QObject = None):
              super(QLoggerObject, self).__init__()
              
      
      class QLogger(object):
          def __init__(self, name: str, parent: QWidget = None, ui: bool = True):
              self.name = name
              self.widget = QLoggerObject(parent)
              self.widget.filter_updated.connect(self.slot)
      
          def slot(self):
              print('Slot invoked')
      
          def __eq__(self, other):
              if isinstance(other, QLogger):
                  return self.name == other.name
      
              if isinstance(other, str):
                  return self.name == other
      
              return super().__eq__(other)
      
      if __name__ == '__main__':
          app = QApplication([])
          l = QLogger('name')
      
      

       

      when the line

      self.widget.filter_updated.connect(self.slot)
      

      is executed, the app crashes with error:

      Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

      if the `_eq_` reimplementation is cancelled out, the script works fine.

       NOTE: The exact same code, with PyQt5 works fine.

      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
              buzzita buzzita
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes