请教关于线程的问题

bluegem218 bluegem218 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

void FortuneServer::incomingConnection(qintptr socketDescriptor)
{
QString fortune = fortunes.at(qrand() % fortunes.size());
FortuneThread *thread = new FortuneThread(socketDescriptor, fortune, this);
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
thread->start();
}

如上代码中,线程指针thread,在new FortuneThread之后,是不是不需要用delete thread来删除?它运行完后,会自动删除掉或者回收?
...全文

相关推荐

评论 6
收藏 已收藏
分享
返回顶部
bluegem218
Qt 21,504 成员 26,693 内容