From 220c237b8c936e5811cdb7c6ba284f747a5f95ad Mon Sep 17 00:00:00 2001 From: Mathew Sutcliffe Date: Wed, 1 Mar 2017 12:42:39 +0000 Subject: [PATCH] refs #884 Fixed some settings usage in CApplication. --- src/blackcore/application.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/blackcore/application.cpp b/src/blackcore/application.cpp index e9c3dd93d..ad66e1dc3 100644 --- a/src/blackcore/application.cpp +++ b/src/blackcore/application.cpp @@ -485,7 +485,11 @@ namespace BlackCore QStringList CApplication::getAllUnsavedSettings() const { - return CSettingsCache::instance()->getAllUnsavedKeys(); + if (this->supportsContexts()) + { + return this->getIContextApplication()->getUnsavedSettingsKeys(); + } + return {}; } CStatusMessage CApplication::saveSettingsByKey(const QStringList &keys) @@ -495,10 +499,10 @@ namespace BlackCore { return this->getIContextApplication()->saveSettingsByKey(keys); } - else - { - return CSettingsCache::instance()->saveToStore(keys); - } + //! \todo If contexts have shut down then we already missed the opportunity to save settings. + //! Saving without contexts is not safe. + BLACK_VERIFY(false); + return CSettingsCache::instance()->saveToStore(keys); } QString CApplication::getTemporaryDirectory() const