From 4a2bfc9239c13272478185ce056e481d7aa1106b Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Tue, 18 Jan 2011 16:59:06 -0200 Subject: Fix bug#552 - "Segmentation fault when using QUiLoader and QTabWidget" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewer: Renato Araújo Marcelo Lira --- libpyside/pyside.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'libpyside/pyside.cpp') diff --git a/libpyside/pyside.cpp b/libpyside/pyside.cpp index 5cb107ae4..08c12f80c 100644 --- a/libpyside/pyside.cpp +++ b/libpyside/pyside.cpp @@ -112,8 +112,10 @@ static void destructionVisitor(SbkObject* pyObj, void* data) PyTypeObject* pyQObjectType = reinterpret_cast(realData[1]); if (pyObj != pyQApp && PyObject_TypeCheck(pyObj, pyQObjectType)) { - if (Shiboken::Object::hasOwnership(pyObj)) - Shiboken::callCppDestructor(Shiboken::Object::cppPointer(pyObj, Shiboken::SbkType())); + if (Shiboken::Object::hasOwnership(pyObj) && Shiboken::Object::isValid(pyObj, false)) { + Shiboken::callCppDestructor(Shiboken::Object::cppPointer(pyObj, pyQObjectType)); + Shiboken::Object::setValidCpp(pyObj, false); + } } }; -- cgit v1.2.3