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

SegFault due to erroneous identification of a variable as QListWidgetItem

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P1: Critical
    • 6.0
    • 1.2.0
    • PySide
    • Windows 7 and Linux (Manjaro/Arch)

    Description

      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
          self.functions[number](self)
        File "pyside_startProgram.py", line 67, in createNewThing
          self.undoStack.push(undoAction)
      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.

      Attachments

        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

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes