Fix bug#552 - "Segmentation fault when using QUiLoader and QTabWidget"

Reviewer: Renato Araújo <renato.filho@openbossa.org>
          Marcelo Lira <marcelo.lira@openbossa.org>
This commit is contained in:
Hugo Parente Lima 2011-01-18 16:59:06 -02:00
commit 4a2bfc9239
5 changed files with 68 additions and 3 deletions

View file

@ -112,8 +112,10 @@ static void destructionVisitor(SbkObject* pyObj, void* data)
PyTypeObject* pyQObjectType = reinterpret_cast<PyTypeObject*>(realData[1]);
if (pyObj != pyQApp && PyObject_TypeCheck(pyObj, pyQObjectType)) {
if (Shiboken::Object::hasOwnership(pyObj))
Shiboken::callCppDestructor<QObject>(Shiboken::Object::cppPointer(pyObj, Shiboken::SbkType<QObject*>()));
if (Shiboken::Object::hasOwnership(pyObj) && Shiboken::Object::isValid(pyObj, false)) {
Shiboken::callCppDestructor<QObject>(Shiboken::Object::cppPointer(pyObj, pyQObjectType));
Shiboken::Object::setValidCpp(pyObj, false);
}
}
};