Comment 7 for bug 1070772

Revision history for this message
Julian Taylor (jtaylor) wrote :

it segfaults for all pythons now, including the -dbg versions.

the problematic code part looks pretty broken:
...
       Py_DECREF((PyObject*)self);
    }
    //Python Object is not destroyed yet
    if (cppData && Shiboken::BindingManager::instance().hasWrapper(cppData)) {
        self->d->hasOwnership = false;
        // the cpp object instance was deleted
        delete[] self->d->cptr;
        self->d->cptr = 0;
    }
...

it decrefs self to zero and then dereferences members again, before a certain commit the comment:
// After this point the object can be death do not use the self pointer bellow
was below the decref instead of at the end of the function, so this code is very likely broken.

unfortunately this is not even the cause of the crash, it already crashes on the decref above, exchanging the order of the code segments does not fix it.

commenting the decref (introducing a memleak) fixes python2 but python 3 still fails:
  70 - sample_duck_punching (SEGFAULT)
 150 - sample_static_nonstatic_methods (SEGFAULT)