From efad1c8b8cd10ad43207610ca7837308f4c024da Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Wed, 9 Feb 2011 18:03:09 -0200 Subject: Fix bug 668 - "QFileSystemModel setRootPath stops application from quitting." MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewer: Luciano Wolf Renato Araújo --- libpyside/pyside.cpp | 2 ++ tests/QtGui/CMakeLists.txt | 1 + tests/QtGui/bug_668.py | 21 +++++++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 tests/QtGui/bug_668.py diff --git a/libpyside/pyside.cpp b/libpyside/pyside.cpp index 08c12f80c..ae3ce3f2e 100644 --- a/libpyside/pyside.cpp +++ b/libpyside/pyside.cpp @@ -113,7 +113,9 @@ static void destructionVisitor(SbkObject* pyObj, void* data) if (pyObj != pyQApp && PyObject_TypeCheck(pyObj, pyQObjectType)) { if (Shiboken::Object::hasOwnership(pyObj) && Shiboken::Object::isValid(pyObj, false)) { + Py_BEGIN_ALLOW_THREADS Shiboken::callCppDestructor(Shiboken::Object::cppPointer(pyObj, pyQObjectType)); + Py_END_ALLOW_THREADS Shiboken::Object::setValidCpp(pyObj, false); } } diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt index dd24a86d2..a2fd9dc6e 100644 --- a/tests/QtGui/CMakeLists.txt +++ b/tests/QtGui/CMakeLists.txt @@ -37,6 +37,7 @@ PYSIDE_TEST(bug_653.py) PYSIDE_TEST(bug_660.py) PYSIDE_TEST(bug_662.py) PYSIDE_TEST(bug_667.py) +PYSIDE_TEST(bug_668.py) PYSIDE_TEST(customproxywidget_test.py) PYSIDE_TEST(deepcopy_test.py) PYSIDE_TEST(float_to_int_implicit_conversion_test.py) diff --git a/tests/QtGui/bug_668.py b/tests/QtGui/bug_668.py new file mode 100644 index 000000000..924ff1946 --- /dev/null +++ b/tests/QtGui/bug_668.py @@ -0,0 +1,21 @@ +# coding: utf-8 +from PySide.QtCore import * +from PySide.QtGui import * + +import sys + +class A(QMainWindow): + def __init__(self, parent=None): + super(A, self).__init__(parent) + a = QFileSystemModel(self) + a.setRootPath(QDir.homePath()) + + v = QTreeView(self) + v.setModel(a) + self.setCentralWidget(v) + +app = QApplication([]) +m = A() +m.show() +QTimer.singleShot(0, m.close) +app.exec_() -- cgit v1.2.3