Wait for the job queue to finish before shutting down

This commit is contained in:
Michael Zanetti 2019-11-15 18:20:26 +01:00
parent 3eac06de6e
commit 2361cc0473

View File

@ -172,15 +172,21 @@ LogEngine::LogEngine(const QString &driver, const QString &dbName, const QString
}
}
checkDBSize();
connect(&m_jobWatcher, SIGNAL(finished()), this, SLOT(handleJobFinished()));
checkDBSize();
}
/*! Destructs the \l{LogEngine}. */
LogEngine::~LogEngine()
{
// Process the job queue before allowing to shut down
while (!m_jobQueue.isEmpty()) {
qApp->processEvents();
}
if (!m_jobWatcher.isFinished()) {
m_jobWatcher.waitForFinished();
}
m_db.close();
}