Important: Please read the Qt Code of Conduct -

Access violation error in QtConcurrent updating QLabel

  • 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

    void Sparsh::connectCam()
    QString str[]={"Connecting.","Connecting..","Connecting..."};
    unsigned int i=1;

    if(ui.lblStatus) // i tried this but no help :(



    ui.lblStatus->setText("Device Connected...!");



  • Moderators


    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.

Log in to reply