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

Crash when using QProxyStyle

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Done
    • Affects Version/s: 5.12.1
    • Fix Version/s: 5.12.2
    • Component/s: PySide
    • Labels:
      None
    • Environment:
      Kubuntu 18.04 (x64), Python 3.6.7
    • Platform/s:
      Linux/X11
    • Commits:
      e1ce71572446e68bcd78fd37a061b7f32d40bd00 (pyside/pyside-setup/5.12)

      Description

      Test case:

      from PySide2.QtWidgets import QApplication, QMainWindow, QStyle, QProxyStyle, QSlider
      from PySide2.QtCore import Qt
      
      
      class MyStyle(QProxyStyle):
      
          def styleHint(self, hint, option=None, widget=None, returnData=None):
              if hint == QStyle.SH_Slider_AbsoluteSetButtons:
                  return Qt.LeftButton | Qt.MidButton | Qt.RightButton
              return super().styleHint(hint, option, widget, returnData)
      
      
      app = QApplication()
      
      slider = QSlider()
      slider.setStyle(MyStyle()) # Comment this and crash disappears
      slider.show()
      
      exit(app.exec_())
      

      Backtrace:

      #0  PySequence_Check () at ../Objects/abstract.c:1478
      #1  0x00007ffff656520d in Shiboken::Object::setSequenceOwnership(_object*, bool) () from /home/estan/orexplore/corestudio/venv/lib/python3.6/site-packages/shiboken2/libshiboken2.abi3.so.5.12
      #2  0x00007ffff58bbe09 in Sbk_QProxyStyle_Init () from /home/estan/orexplore/corestudio/venv/lib/python3.6/site-packages/PySide2/QtWidgets.abi3.so
      #3  0x0000000000555421 in type_call.lto_priv () at ../Objects/typeobject.c:915
      #4  0x00000000005a730c in _PyObject_FastCallDict (kwargs=<optimized out>, nargs=<optimized out>, args=<optimized out>, func=0xad1518) at ../Objects/tupleobject.c:131
      #5  _PyObject_FastCallKeywords () at ../Objects/abstract.c:2496
      #6  0x0000000000503073 in call_function.lto_priv () at ../Python/ceval.c:4861
      #7  0x0000000000506859 in _PyEval_EvalFrameDefault () at ../Python/ceval.c:3335
      #8  0x0000000000504c28 in PyEval_EvalFrameEx (throwflag=0, f=0xae3c48) at ../Python/ceval.c:4166
      #9  _PyEval_EvalCodeWithName.lto_priv.1761 () at ../Python/ceval.c:4166
      #10 0x0000000000506393 in PyEval_EvalCodeEx (closure=0x0, kwdefs=0x0, defcount=0, defs=0x0, kwcount=0, kws=0x0, argcount=0, args=0x0, locals=<optimized out>, globals=<optimized out>, _co=<optimized out>) at ../Python/ceval.c:4187
      #11 PyEval_EvalCode (co=<optimized out>, globals=<optimized out>, locals=<optimized out>) at ../Python/ceval.c:731
      #12 0x0000000000634d52 in run_mod () at ../Python/pythonrun.c:1025
      #13 0x0000000000634e0a in PyRun_FileExFlags () at ../Python/pythonrun.c:978
      #14 0x00000000006385c8 in PyRun_SimpleFileExFlags () at ../Python/pythonrun.c:419
      #15 0x00000000006387a5 in PyRun_AnyFileExFlags () at ../Python/pythonrun.c:81
      #16 0x000000000063915a in run_file (p_cf=0x7fffffffdaac, filename=<optimized out>, fp=<optimized out>) at ../Modules/main.c:340
      #17 Py_Main () at ../Modules/main.c:810
      #18 0x00000000004a6f10 in main (argc=2, argv=0x7fffffffdca8) at ../Programs/python.c:69
      

      Uncommenting the setStyle and the crash goes away.

      Sorry for the lousy backtrace. This was PySide2 5.12.1 installed via pip:

      (venv) [estan@newton corestudio]$ pip list
      Package        Version
      -------------- -------
      docopt         0.6.2  
      h5py           2.9.0  
      numpy          1.16.0 
      pip            10.0.1 
      pyqt-distutils 0.7.3  
      PySide2        5.12.1 
      setuptools     39.1.0 
      shiboken2      5.12.1 
      six            1.12.0 
      vtk            8.1.2  
      You are using pip version 10.0.1, however version 19.0.1 is available.
      You should consider upgrading via the 'pip install --upgrade pip' command.
      (venv) [estan@newton corestudio]$
      

      Running on Kubuntu 18.04, Python 3.6.7.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            • Assignee:
              crmaurei Cristian Maureira-Fredes
              Reporter:
              estan Elvis Stansvik
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes