Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
5.15.0
-
None
-
PySide/Qt 5.15.0, Python 3.8.3
Description
How to reproduce:
Run this piece of code:
from PySide2 import QtCore import time import sys class Producer(QtCore.QThread): def run(self): time.sleep(2) print('hi') if __name__ == "__main__": app = QtCore.QCoreApplication(sys.argv) producer = Producer() producer.start() print("About to call Qthread.wait()") producer.wait() # hangs print("Qthread finished")
Expected output:
About to call Qthread.wait() hi Qthread finished
This happens instead:
About to call Qthread.wait() * hangs here, no error message printed *
More details:
Using an arbitrary large timeout prevents the program from hanging (this produces the expected output):
if __name__ == "__main__": app = QtCore.QCoreApplication(sys.argv) producer = Producer() producer.start() print("About to call Qthread.wait()") producer.wait(1000000) # 1000000 ms >> 2 s print("Qthread finished")
Calling wait() on a finished QThread without timeout does not hang the program (produces the expected output):
if __name__ == "__main__": app = QtCore.QCoreApplication(sys.argv) producer = Producer() producer.start() print("About to call Qthread.wait()") time.sleep(5) producer.wait() print("Qthread finished")
Attachments
Issue Links
- relates to
-
PYSIDE-1332 REG->5.15.0: QThread.wait() and QWaitCondition.wait() cause hard crash
-
- Closed
-