首页 > 代码库 > QThread: Destroyed while thread is still running解决办法

QThread: Destroyed while thread is still running解决办法

这是由于线程未执行完毕,但提前关闭引起的,常规结束线程的步骤为:

 

(1)disconect(.........) ;  //关闭所有与该进程对象关联的信号和槽
(2)thread->quit();
(3)thread->wait();
(4)thread->deleteLater();

 

实际测试,只用(2)(3)也行。

QThread: Destroyed while thread is still running解决办法