I have set a main window QP_Qt
with a label on it named serverStatusLabel
:
class NP_Qt : public QMainWindow
{
Q_OBJECT
public:
NP_Qt(QWidget *parent = 0, Qt::WFlags flags = 0);
~NP_Qt();
void setServerStatusLabel(QString status);
void setClientStatusLabel(QString status);
private:
Ui::NP_QtClass ui;
}
void NP_Qt::setServerStatusLabel(QString status)
{
ui.TCPServerStatusLabel->setText(status);
}
No error occurred during compilation.
At runtime, When setServerStatusLabel
is called from another class:
void ServerListenThread::run()
{
if(! tcpServer.listen(QHostAddress::LocalHost, portNumber)) {
window->setServerStatusLabel("Failed to listen on this port");
} else {
window->setServerStatusLabel("Listening");
}
}
Error occurred:
Unhandled exception at 0x771115de of SP_Qt.exe: 0xC0000005 : access violation at 0xccccce2c
What may cause this error ?