mirror of
https://github.com/tnodir/fort
synced 2024-11-15 12:40:54 +00:00
UI: HostInfoCache: Abort lookups on exit.
This commit is contained in:
parent
b65e76eba2
commit
2bd992bd12
@ -11,6 +11,12 @@ HostInfoCache::HostInfoCache(QObject *parent) :
|
||||
connect(&m_triggerTimer, &QTimer::timeout, this, &HostInfoCache::cacheChanged);
|
||||
}
|
||||
|
||||
HostInfoCache::~HostInfoCache()
|
||||
{
|
||||
clear();
|
||||
abort();
|
||||
}
|
||||
|
||||
QString HostInfoCache::hostName(const QString &address)
|
||||
{
|
||||
HostInfo *hostInfo = m_cache.object(address);
|
||||
@ -33,6 +39,11 @@ void HostInfoCache::clear()
|
||||
emitCacheChanged();
|
||||
}
|
||||
|
||||
void HostInfoCache::abort()
|
||||
{
|
||||
m_manager->abort();
|
||||
}
|
||||
|
||||
void HostInfoCache::handleFinishedLookup(const QString &address, const QString &hostName)
|
||||
{
|
||||
HostInfo *hostInfo = m_cache.object(address);
|
||||
|
@ -15,6 +15,7 @@ class HostInfoCache : public QObject
|
||||
|
||||
public:
|
||||
explicit HostInfoCache(QObject *parent = nullptr);
|
||||
~HostInfoCache() override;
|
||||
|
||||
signals:
|
||||
void cacheChanged();
|
||||
@ -23,6 +24,7 @@ public slots:
|
||||
QString hostName(const QString &address);
|
||||
|
||||
void clear();
|
||||
void abort();
|
||||
|
||||
private slots:
|
||||
void handleFinishedLookup(const QString &address, const QString &hostName);
|
||||
|
@ -12,6 +12,7 @@ WorkerManager::WorkerManager(QObject *parent) : QObject(parent) { }
|
||||
|
||||
WorkerManager::~WorkerManager()
|
||||
{
|
||||
clear();
|
||||
abort();
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,8 @@ public:
|
||||
~WorkerManager() override;
|
||||
CLASS_DELETE_COPY_MOVE(WorkerManager)
|
||||
|
||||
bool aborted() const { return m_aborted; }
|
||||
|
||||
int maxWorkersCount() const { return m_maxWorkersCount; }
|
||||
void setMaxWorkersCount(int v) { m_maxWorkersCount = v; }
|
||||
|
||||
@ -29,6 +31,7 @@ signals:
|
||||
|
||||
public slots:
|
||||
void clear();
|
||||
void abort();
|
||||
|
||||
void enqueueJob(WorkerJob *job);
|
||||
WorkerJob *dequeueJob();
|
||||
@ -40,9 +43,6 @@ public slots:
|
||||
protected:
|
||||
virtual WorkerObject *createWorker();
|
||||
|
||||
bool aborted() const { return m_aborted; }
|
||||
void abort();
|
||||
|
||||
private:
|
||||
void setupWorker();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user