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>
This commit is contained in:
Hugo Parente Lima 2011-08-12 16:56:39 -03:00
commit b261ff4642
3 changed files with 28 additions and 4 deletions

18
tests/QtCore/bug_953.py Normal file
View file

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