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

SegFault due to erroneous identification of a variable as QListWidgetItem



    • Type: Bug
    • Status: Closed
    • Priority: P1: Critical
    • Resolution: Fixed
    • Affects Version/s: 1.2.0, dev
    • Fix Version/s: dev
    • Component/s: PySide
    • Labels:
    • Environment:
      Windows 7 and Linux (Manjaro/Arch)


      Attached is a simple GUI that crashes when a random number of user actions takes place.

      To run the attached examples:

      0) Download all three of the attached files to the same directory.
      1) Start pyside_startProgram.py with python2.
      2) Press the "THING" button a few times to create a few QTreeWidgetItems in the QTreeWidget (a QDialog briefly appears since this sometimes causes a crash).
      3) Drag a few of these to the QListWidget below (the crash/error may happen here).
      4) Press the "TEST" button to automatically perform undo, redo, list copy, and THING creation.

      On Windows, the program will become unresponsive and have to be killed. On Linux, the above procedure will either terminate with a SegFault after calling createNewThing(), or raise an exception:

      Traceback (most recent call last):
        File "pyside_startProgram.py", line 86, in test
        File "pyside_startProgram.py", line 67, in createNewThing
      AttributeError: 'PySide.QtGui.QListWidgetItem' object has no attribute 'redo'

      undoAction is either type LoadThings or Add2List, both of which subclass QUndoCommand (see pyside_undoCommands.py). For some reason, undoAction is being identified as a QListWidgetItem as it is being passed to the undoStack (QUndoStack). Only slightly more use of the GUI soon leads to a SegFault, usually after further complaints about the QListWidgetItem in the QUndoStack.

      As noted in step two above, this bug can also be triggered by dragging items from the QTreeWidget to the QListWidget (I didn't figure out how to automate this for the test() function).

      PyQt does not crash or raise exceptions and can run indefinitely.

      I have seen similar errors in other parts of my code where a QGraphics*Item and a QTransform is misidentified as a QListWidgetItem, leading to an eventual SegFault.

      This bug seems similar to PYSIDE-119.


        1. pyside_224_startProgram.py
          3 kB
        2. pyside_224_undoCommands.py
          2 kB
        3. pyside_224_windowLayout.py
          3 kB
        4. pyside_startProgram.py
          3 kB
        5. pyside_undoCommands.py
          2 kB
        6. pyside_windowLayout.py
          3 kB

          Issue Links

          For Gerrit Dashboard: PYSIDE-224
          # Subject Branch Project Status CR V



              ctismer Christian Tismer
              mark_harrison Mark Harrison
              0 Vote for this issue
              4 Start watching this issue



                  Gerrit Reviews

                  There are no open Gerrit changes