I am trying to start a background thread (qthread) which should control a flag in gui and it will not work! It is created, but at runtime I get this error:
"Unhandled exception at 0x0120f494 in program.exe: 0xC0000005: read location of access violation 0xcdcdce55."
and it breaks into the string "connect". What is the best way to do this?
guiclass::guiclass(){
thread *t = new thread();
}
thread::thread(){
guiclass *c = new guiclass();
connect(c->checkBox, SIGNAL(stateChanged(int)), this, SLOT(checked(int)));
....
start work
....
}
bool thread::checked(int c){
return(c==0);
}
void thread::run(){
if(checked()){
do stuff
}
}
source
share