Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Access violation error in QtConcurrent updating QLabel
azadsagar last edited by
hello i have this 'access violation reading..." error in QtConcurrent thread when am i terminating my application. My thread is updating some status in QLabel. it seems like when i exit my application QLabel object is being destroyed and my thread is working on it. how can i resolve it ? here is my source
unsigned int i=1;
if(ui.lblStatus) // i tried this but no help :(
Qt's GUI classes are not thread-safe. You can only update them in the main thread.
If you want to trigger an update from a secondary thread, your secondary thread must invoke a slot in the main thread to update your QLabel.
- Use "QMetaObject::invokeMethod()":http://qt-project.org/doc/qt-5/qmetaobject.html#invokeMethod with a Queued Connection, OR
- Emit a signal to invoke the slot.