aboutsummaryrefslogtreecommitdiffstats
path: root/tests/QtCore/bug_927.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/QtCore/bug_927.py')
-rw-r--r--tests/QtCore/bug_927.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/QtCore/bug_927.py b/tests/QtCore/bug_927.py
new file mode 100644
index 000000000..87fb0161f
--- /dev/null
+++ b/tests/QtCore/bug_927.py
@@ -0,0 +1,24 @@
+import time
+import unittest
+
+from PySide.QtCore import QTime, QRunnable, QThreadPool
+
+class Task(QRunnable):
+ def run(self):
+ t = QTime()
+ t.start()
+ time.sleep(2) # Sleep 2 seconds
+
+
+class QThreadPoolTest(unittest.TestCase):
+ '''This used to cause a segfault due the ownership control on globalInstance function '''
+ def testSlowJobs(self):
+ for i in range(3):
+ task = Task()
+ QThreadPool.globalInstance().start(task)
+ time.sleep(1) # Sleep 1 second
+
+ QThreadPool.globalInstance().waitForDone()
+
+if __name__ == '__main__':
+ unittest.main()