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

Strange Crash when using delegates with QSpinBox and QComboBox

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • Not Evaluated
    • None
    • 1.1.0
    • PySide
    • None
    • windows xp, 7, python 2.7, pyside 1.1.0 and 1.1.2

    Description

      The problem is not very easy to reproduce.
      Basically if you keep double-clicking the fields randomly at some point the application will crash.

      Happens mostly if you double click a field with a delegate QSpinBox and then a QComboBox.
      You can get a relatively consistent crash, if you click the QSpinBox part a lot, and then the QLineEdit/QComboBox part

      The app crashes completely there's no way to avoid it.
      I've done lot of testing and lot of research and no information about it.

      It affects only pyside, and not pyqt.

      It affects delegates.
      So the basic test-case includes a tableview, a tablemodel and a delegate.

      Before crashing pyside calls createEditor sucessfully, (returns a QComboBox), but when is ABOUT to call setEditorData it tries to connect/disconnect the signals and fail. setEditorData also fails because, for some extrange reason the editor passed is a QSpinBox instead of a QComboBox (the new spinbox doesn't seem to be a previously created object).

      Avaris at irc kindly tried to help me, and reduced the problem to the test-cases attached.

      He also noted that it doesn't (seem to) crash if in the overwritten methods every object is created manually. That is instead of using:
      return super(Delegate, self).createEditor(parent, option, index)
      do something like
      return QSpinBox(parent)

      Also crashes when using the form
      QtGui.QStyledItemDelegate.createEditor(self, parent, option, index)

      Avaris stated that the crash probability seems to be correlated by the number of constructed default editors (super ones).

      Another strange thing happening is that the setEditor method gets called twice sometimes.

      ------
      As a side note, at some moment there's was a problem with
      QAbstractItemDelegate:: closeEditor ( QWidget * editor, QAbstractItemDelegate::EndEditHint hint = NoHint )
      as the last parameter seems that is not passed. even it's marked as optional the value doesnt get passed. The signal is emmited like
      closeEditor(editor)
      but the optional parameter doesn't get passed.

      Attachments

        1. other.py
          2 kB
        2. pyside-119-other.py
          2 kB
        3. pyside-119-testing.py
          2 kB
        4. testing.py
          2 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            jerobarraco Jerónimo Barraco Mármol
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes