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:
parent
01b90a3a58
commit
b261ff4642
3 changed files with 28 additions and 4 deletions
18
tests/QtCore/bug_953.py
Normal file
18
tests/QtCore/bug_953.py
Normal 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_()
|
||||
Loading…
Add table
Add a link
Reference in a new issue