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

    XMLWordPrintable

Details

    • a4690116881477d09f34f6b20b2ee0f31c06163d

    Description

      (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
      values
      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

      Attachments

        1. pyobjectwrapper.patch
          0.8 kB
        2. test.py
          0.7 kB
        3. traceback.txt
          5 kB
        4. pyside-17-test.py
          0.7 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes