PySide/tests/QtCore/bug_953.py
Hugo Parente Lima b261ff4642 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>
2011-08-12 18:28:44 -03:00

18 lines
430 B
Python

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_()