summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2011-08-12 16:56:39 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2011-08-12 18:28:44 -0300
commitb261ff4642d4c4cc7e33862c3ea1477e3e6d89fc (patch)
treea3c7bdabaa16eb3162425ed781e925aa05d7f7d6 /tests
parent01b90a3a587d6afd9ec4bf3d6ad2ea83a9548b6d (diff)
downloadpyside-b261ff4642d4c4cc7e33862c3ea1477e3e6d89fc.tar.gz
pyside-b261ff4642d4c4cc7e33862c3ea1477e3e6d89fc.tar.xz
pyside-b261ff4642d4c4cc7e33862c3ea1477e3e6d89fc.zip
Fix bug 953 - "Segfault when QObject is garbage collected after QTimer.singeShot"
Reviewer: Renato Ara├║jo <renato.filho@openbossa.org> Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/QtCore/CMakeLists.txt1
-rw-r--r--tests/QtCore/bug_953.py18
2 files changed, 19 insertions, 0 deletions
diff --git a/tests/QtCore/CMakeLists.txt b/tests/QtCore/CMakeLists.txt
index 9900a85..aa646d7 100644
--- a/tests/QtCore/CMakeLists.txt
+++ b/tests/QtCore/CMakeLists.txt
@@ -20,6 +20,7 @@ PYSIDE_TEST(bug_920.py)
PYSIDE_TEST(bug_927.py)
PYSIDE_TEST(bug_931.py)
PYSIDE_TEST(bug_938.py)
+PYSIDE_TEST(bug_953.py)
PYSIDE_TEST(blocking_signals_test.py)
PYSIDE_TEST(classinfo_test.py)
PYSIDE_TEST(child_event_test.py)
diff --git a/tests/QtCore/bug_953.py b/tests/QtCore/bug_953.py
new file mode 100644
index 0000000..37ef28e
--- /dev/null
+++ b/tests/QtCore/bug_953.py
@@ -0,0 +1,18 @@
+from PySide.QtCore import *
+
+class Dispatcher(QObject):
+ _me = None
+
+ def __init__(self):
+ super(Dispatcher, self).__init__()
+ self._me = self
+ QTimer.singleShot(0, self._finish)
+
+ def _finish(self):
+ del self._me # It can't crash here!
+ QTimer.singleShot(10, QCoreApplication.instance().quit)
+
+if __name__ == '__main__':
+ app = QCoreApplication([])
+ Dispatcher()
+ app.exec_()