fix(segment fault):线程非正常退出导致的崩溃问题

This commit is contained in:
jzxc95 2023-08-25 17:32:09 +08:00
parent acb36fdbda
commit 313397e0d3
1 changed files with 6 additions and 4 deletions

View File

@ -147,11 +147,13 @@ int main(int argc, char *argv[])
}
}
QThread thread;
QThread *thread = new QThread();
KyNetworkResourceManager *p_networkResource = KyNetworkResourceManager::getInstance();
p_networkResource->moveToThread(&thread);
QObject::connect(&thread, SIGNAL(started()), p_networkResource, SLOT(onInitNetwork()));
thread.start();
p_networkResource->moveToThread(thread);
QObject::connect(thread, &QThread::started, p_networkResource, &KyNetworkResourceManager::onInitNetwork);
QObject::connect(&a,&QtSingleApplication::aboutToQuit, thread, &QThread::quit);
QObject::connect(thread, &QThread::finished, thread, &QThread::deleteLater);
thread->start();
// Internationalization
QString locale = QLocale::system().name();