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

Segmentation fault on Signal.connect without QObject

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P5: Not important
    • 6.6.1, 6.5.4
    • 6.6.0, 6.5.3
    • PySide
    • None
    • 2a1034684 (dev), ae31d6c7c (6.6), f7224a57a (6.5)

    Description

      This code segfaults on Windows and Linux, Python 3.11.6 and 3.12.0, PySide6 6.5.3 and 6.6.0:

      from PySide6.QtCore import Signal
      
      class Signaler:
          my_signal = Signal()
      
          def __init__(self):
              self.my_signal.connect(self.fun)
      
          def fun(self):
              pass
      
      Signaler()
      print("Done")  # never printed
      

      Before crashing, it prints

      AttributeError: 'Signaler' object has no attribute ''
      

      It appears the problem is that Signaler does not derive from QObject. Nonetheless, Python should not crash, and a useful error message should be printed.

      Attachments

        1. pyside2510_stack.txt
          29 kB
          Friedemann Kleint
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kleint Friedemann Kleint
            bers bers bers
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes