Quantcast
Channel: QtWebEngine
Viewing all articles
Browse latest Browse all 13965

PySide QEvent post crash

$
0
0
Hello everyone, I’m working on Linux Ubuntu 12.10, with PySide 1.1.1 and python 2.7 I have a problem when posting QEvent through a QStateMachine. If I want it to work I have to keep a reference on the event, or it crashes. I have set up a little sample code to illustrate my problem. I would like to know if I am doing it wrong or if it is a known problem and if I should use the workaround (keeping a reference on the event) ? #!/usr/bin/python   from __future__ import print_function import sys from PySide.QtCore import * from PySide.QtGui import *   app = QApplication(sys.argv) sm = QStateMachine() init = QState(sm) sm.setInitialState(init) sm.start()   e = None def no_crash():     global e     print("send an event that doesn't crash...")     e = QEvent(QEvent.Type(QEvent.registerEventType()))     sm.postEvent(e)   def crash():     print("and one that does...")     e = QEvent(QEvent.Type(QEvent.registerEventType()))     sm.postEvent(e)   QTimer.singleShot(2000, no_crash) QTimer.singleShot(4000, crash)   sys.exit(app.exec_()) Thanks by advance for your help Pierre

Viewing all articles
Browse latest Browse all 13965

Trending Articles