From bbf66078ea911cbacca69550da15fa21a000e3ab Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Fri, 12 Aug 2011 16:56:39 -0300 Subject: Fix bug 953 - "Segfault when QObject is garbage collected after QTimer.singeShot" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewer: Renato Araújo Luciano Wolf --- tests/QtCore/bug_953.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tests/QtCore/bug_953.py (limited to 'tests/QtCore/bug_953.py') diff --git a/tests/QtCore/bug_953.py b/tests/QtCore/bug_953.py new file mode 100644 index 000000000..37ef28ea1 --- /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_() -- cgit v1.2.3