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

atexit-time segfault after calling QApplication.thread()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.5.0, 6.4.3
    • 6.3.2, 6.4.1, 6.4.2
    • PySide, Shiboken
    • None
    • Linux/Wayland, Linux/Other display system
    • cbb0b363e (dev), 4ee2bfc29 (6.4)

    Description

      After running an application that accesses the `thread()` method on the main `QApplication`, I see a segmentation fault at Python process shutdown time. It looks as though it's occurring when the shiboken atexit handlers are being run.

      I'm currently seeing this on Ubuntu 22.04 Desktop (in a VM running on a macOS Ventura/Intel host), but we've also witnessed this segfault (or something very much like it) on an Ubuntu 20.04 VM, and on GitHub Actions ubuntu-22.04 runners, running under `xvfb`. Windows and macOS seem to be unaffected - this appears to be a Linux-only issue.

      Here's a minimum reproducer on my machine:

      ```

      from PySide6.QtWidgets import QApplication, QWidget

      app = QApplication()
      window = QWidget()
      window.show()
      app.thread()
      app.exec()

      ```

       

      When I run the above it brings up an application window as expected. When I close the window (via the close button), the process reports a segfault.

       

      If I remove the `app.thread()` line, the segfault disappears.

       

      The above was cut down from a much larger example, whose test suite was consistently segfaulting at process end time on every run. I've verified that removing calls to `QApplication.thread()` fixes the segfault there, too.

       

      I should be able to get a traceback; I'll post that shortly.

      Attachments

        1. pyside2254_diag.diff
          0.7 kB
        2. pyside2254_stack.txt
          151 kB
        3. pyside2254.py
          0.4 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kleint Friedemann Kleint
            mdickinson Mark Dickinson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes