From 26498ca91673e74907d3ee18adadacb4191fb8b6 Mon Sep 17 00:00:00 2001 From: Mathew Sutcliffe Date: Thu, 29 Dec 2016 02:53:47 +0000 Subject: [PATCH] refs #847 Use a local static QTempDirectory so it is not destroyed too early. --- src/blackcore/application.cpp | 12 ++++-------- src/blackcore/application.h | 2 -- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/blackcore/application.cpp b/src/blackcore/application.cpp index 3847cdcaf..b99b96fe6 100644 --- a/src/blackcore/application.cpp +++ b/src/blackcore/application.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -431,14 +432,9 @@ namespace BlackCore QString CApplication::getTemporaryDirectory() const { - if (this->m_tempDirectory.isValid()) - { - return this->m_tempDirectory.path(); - } - else - { - return QDir::tempPath(); - } + static QTemporaryDir tempDir; + if (tempDir.isValid()) { return tempDir.path(); } + return QDir::tempPath(); } QString CApplication::getInfoString(const QString &separator) const diff --git a/src/blackcore/application.h b/src/blackcore/application.h index 18ea466fe..3f0f4924f 100644 --- a/src/blackcore/application.h +++ b/src/blackcore/application.h @@ -22,7 +22,6 @@ #include #include #include -#include #include #include @@ -438,7 +437,6 @@ namespace BlackCore QScopedPointer m_setupReader; //!< setup reader QScopedPointer m_webDataServices; //!< web data services QScopedPointer m_fileLogger; //!< file logger - QTemporaryDir m_tempDirectory; //!< temp.directory for the lifetime of application object QNetworkAccessManager m_accessManager { this }; //!< single network access manager CCookieManager m_cookieManager; //!< single cookie manager for our access manager QString m_applicationName; //!< application name