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

Segfault when emitting a signal with a None parameter from another thread



    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 1.1.0, 1.2.x
    • Fix Version/s: 5.9
    • Component/s: PySide
    • Commits:


      (Note this was: http://bugs.pyside.org/show_bug.cgi?id=1152)

      See the attached example for a demonstration of the problem.
      I'll also attach the traceback I got from gdb.

      Essentially what appears to happen is this:

      1. PySide::MetaFunction::call converts the arguments to the signal to cpp
      2. The shiboken converter to do that converts Py_None to a NULL-pointer
      (pythonToCppPointer in libshiboken/sbkconvert.cpp)
      3. The QMetaObject system tries to make a copy of the PyObject pointer using a
      PySide::PyObjectWrapper which then goes boom when trying to INCREF its
      underlying python object

      I have attached a simple patch that uses Py_XINCREF/DECREF instead. With
      this I no longer get a crash, but I don't know the pyside internals well
      enough to know if this is a good solution or just masking the symptoms of the
      real problem.

      Versions used:

      apiextractor 0.10.10
      generatorrunner 0.6.16
      shiboken 1.1.0
      pyside 1.1.0

      Additional notes:
      I verified that the bug is still present in the current gittorious/gerrit repositories

      The original bug also contained this comment:

      > Hugo Parente Lima 2012-02-27 19:06:49 CET
      > Maybe would be nice to avoid create the PyObjectWrapper instance with a null pointer instead of using X_INC/DECREF's


        1. pyobjectwrapper.patch
          0.8 kB
        2. pyside-17-test.py
          0.7 kB
        3. test.py
          0.7 kB
        4. traceback.txt
          5 kB
        For Gerrit Dashboard: PYSIDE-17
        # Subject Branch Project Status CR V



            • Assignee:
              crmaurei Cristian Maureira-Fredes
              andkit Andy Kittner
            • Votes:
              3 Vote for this issue
              4 Start watching this issue


              • Created:

                Gerrit Reviews

                There are no open Gerrit changes