我正在尝试运行需要监视 gui 中的复选框的后台线程(qthread),但它不会运行!它构建但在运行时我收到此错误:
“program.exe 中 0x0120f494 处的未处理异常:0xC0000005:访问冲突读取位置 0xcdcdce55。”
它在“连接”线上中断。做这个的最好方式是什么?
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
}
}