Pyqt Main Window Keeps Crashing After Receiving Data From A Thread
i have a QMainWindow that starts a QThread and waits for data from the network. updates UI when it receive any data. the problem is : it sometimes crash. and sometimes doesn't , al
Solution 1:
GUI widgets may be accessed only from main thread, meaning the thread that calls QApplication.exec()
. Access to GUI widgets from any other thread – what you're doing with your calls to self.parent()
– is undefined behaviour, in your case this means crashes.
You signals and slots to communicate between background threads and the GUI in a safe manner.
And please read the documentation about Qt's threading functionality, because the above is actually essential knowledge when dealing with multi-threaded GUI applications, not only in Qt, but in any other GUI framework, too.
Post a Comment for "Pyqt Main Window Keeps Crashing After Receiving Data From A Thread"