3
我想运行一个后台线程(qthread),需要监视gui中的复选框,它不会运行!它构建,但在运行时我得到这个错误:从QThread类监视Qt GUI
“程序中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
}
}
您在初始化'c-> checkBox'的位置?你怎么处理这个事实,即'新的guiclass'调用'新的线程'调用'新的guiclass''调用'新的线程'调用'新的guiclass'调用'新的线程'调用'新的guiclass' ... – Mat 2011-06-08 20:42:16
显然我不是处理相互调用的线程,看起来像我的问题。那么,我将如何监控guiclass而不创建一个guiclass对象? – JonnyCplusplus 2011-06-08 20:47:09