diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/QtCore/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/QtCore/bug_927.py | 24 |
2 files changed, 25 insertions, 0 deletions
diff --git a/tests/QtCore/CMakeLists.txt b/tests/QtCore/CMakeLists.txt index a088a327f..266c8f94b 100644 --- a/tests/QtCore/CMakeLists.txt +++ b/tests/QtCore/CMakeLists.txt @@ -16,6 +16,7 @@ PYSIDE_TEST(bug_820.py) PYSIDE_TEST(bug_826.py) PYSIDE_TEST(bug_829.py) PYSIDE_TEST(bug_835.py) +PYSIDE_TEST(bug_927.py) PYSIDE_TEST(blocking_signals_test.py) PYSIDE_TEST(classinfo_test.py) PYSIDE_TEST(child_event_test.py) 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() |