mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-01-15 03:54:37 +03:00
parent
81a3479fd7
commit
7512b92a36
2 changed files with 4 additions and 3 deletions
src
|
@ -43,6 +43,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
#include <QMetaObject>
|
||||||
|
|
||||||
#include "base/version.h"
|
#include "base/version.h"
|
||||||
|
|
||||||
|
@ -89,7 +90,7 @@ namespace
|
||||||
const char *msgs[] = {"Catching signal: ", sysSigName[signum], "\nExiting cleanly\n"};
|
const char *msgs[] = {"Catching signal: ", sysSigName[signum], "\nExiting cleanly\n"};
|
||||||
std::for_each(std::begin(msgs), std::end(msgs), safePrint);
|
std::for_each(std::begin(msgs), std::end(msgs), safePrint);
|
||||||
signal(signum, SIG_DFL);
|
signal(signum, SIG_DFL);
|
||||||
QCoreApplication::exit(); // unsafe, but exit anyway
|
QMetaObject::invokeMethod(qApp, [] { QCoreApplication::exit(); }, Qt::QueuedConnection); // unsafe, but exit anyway
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef STACKTRACE
|
#ifdef STACKTRACE
|
||||||
|
|
|
@ -141,7 +141,7 @@ TorrentFilesWatcher *TorrentFilesWatcher::instance()
|
||||||
}
|
}
|
||||||
|
|
||||||
TorrentFilesWatcher::TorrentFilesWatcher(QObject *parent)
|
TorrentFilesWatcher::TorrentFilesWatcher(QObject *parent)
|
||||||
: QObject {parent}
|
: QObject(parent)
|
||||||
, m_ioThread {new QThread}
|
, m_ioThread {new QThread}
|
||||||
{
|
{
|
||||||
const auto *btSession = BitTorrent::Session::instance();
|
const auto *btSession = BitTorrent::Session::instance();
|
||||||
|
@ -163,7 +163,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.get());
|
m_asyncWorker->moveToThread(m_ioThread.get());
|
||||||
connect(m_ioThread.get(), &QThread::finished, m_asyncWorker, &QObject::deleteLater);
|
connect(m_ioThread.get(), &QThread::finished, this, [this] { delete m_asyncWorker; });
|
||||||
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)
|
||||||
|
|
Loading…
Reference in a new issue