1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-22 20:44:15 +00:00

Destroy object within appropriate thread

PR #18008.
This commit is contained in:
Vladimir Golovnev 2022-11-13 08:28:33 +03:00 committed by GitHub
parent dcdbd02102
commit bdd56a52d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -269,7 +269,6 @@ TorrentFilesWatcher::~TorrentFilesWatcher()
{ {
m_ioThread->quit(); m_ioThread->quit();
m_ioThread->wait(); m_ioThread->wait();
delete m_asyncWorker;
} }
void TorrentFilesWatcher::initWorker() void TorrentFilesWatcher::initWorker()
@ -282,6 +281,7 @@ void TorrentFilesWatcher::initWorker()
connect(m_asyncWorker, &TorrentFilesWatcher::Worker::torrentFound, this, &TorrentFilesWatcher::onTorrentFound); connect(m_asyncWorker, &TorrentFilesWatcher::Worker::torrentFound, this, &TorrentFilesWatcher::onTorrentFound);
m_asyncWorker->moveToThread(m_ioThread); m_asyncWorker->moveToThread(m_ioThread);
connect(m_ioThread, &QThread::finished, m_asyncWorker, &QObject::deleteLater);
m_ioThread->start(); m_ioThread->start();
for (auto it = m_watchedFolders.cbegin(); it != m_watchedFolders.cend(); ++it) for (auto it = m_watchedFolders.cbegin(); it != m_watchedFolders.cend(); ++it)