summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuciano Wolf <luciano.wolf@openbossa.org>2010-07-19 16:30:11 -0300
committerLuciano Wolf <luciano.wolf@openbossa.org>2010-07-20 14:32:04 -0300
commitcb7d3e95a27392e504f3b99deacddb3a3e0a8a56 (patch)
tree8763560372bd07f9c0ee3561c2115810896d0d36
parentc62c36a64dd4c0fc0cd586c5c2b3d4f97ba3f769 (diff)
downloadpyside-cb7d3e95a27392e504f3b99deacddb3a3e0a8a56.tar.gz
pyside-cb7d3e95a27392e504f3b99deacddb3a3e0a8a56.tar.xz
pyside-cb7d3e95a27392e504f3b99deacddb3a3e0a8a56.zip
Fix bug#252.
Reviewer: Renato Ara├║jo <renato.filho@openbossa.org> Marcelo Lira <marcelo.lira@openbossa.org>
-rw-r--r--PySide/QtGui/glue/qapplication_init.cpp2
-rw-r--r--tests/QtSql/qsqldatabaseandqueries_test.py14
2 files changed, 15 insertions, 1 deletions
diff --git a/PySide/QtGui/glue/qapplication_init.cpp b/PySide/QtGui/glue/qapplication_init.cpp
index 5c87af3..00e37b1 100644
--- a/PySide/QtGui/glue/qapplication_init.cpp
+++ b/PySide/QtGui/glue/qapplication_init.cpp
@@ -8,7 +8,7 @@ void DeleteQApplicationAtExit() {
if (QApplication::instance()) {
//disconnect and decref all widgets used on signals before destroy qApp
PySide::SignalManager::instance().clear();
- delete QApplication::instance();
+ QApplication::instance()->deleteLater();
for (int i = 0; i < QApplicationArgCount; ++i)
delete[] QApplicationArgValues[i];
}
diff --git a/tests/QtSql/qsqldatabaseandqueries_test.py b/tests/QtSql/qsqldatabaseandqueries_test.py
index 7a9d30a..41daccc 100644
--- a/tests/QtSql/qsqldatabaseandqueries_test.py
+++ b/tests/QtSql/qsqldatabaseandqueries_test.py
@@ -6,6 +6,12 @@ import unittest
from PySide import QtSql
from PySide.QtCore import *
+from PySide.QtGui import *
+
+class Foo(QWidget):
+ def __init__(self):
+ QWidget.__init__(self)
+ self.model = QtSql.QSqlTableModel()
class SqlDatabaseCreationDestructionAndQueries(unittest.TestCase):
'''Test cases for QtSql database creation, destruction and queries'''
@@ -51,6 +57,14 @@ class SqlDatabaseCreationDestructionAndQueries(unittest.TestCase):
lastname = query.value(0)
self.assertEqual(lastname, 'Harrison')
+ def testTableModelDeletion(self):
+ app = QApplication([])
+
+ bar = Foo()
+ model = bar.model
+ del bar
+ del app
+
if __name__ == '__main__':
unittest.main()