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

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

      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.

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes