Browse Source

Properly release settings class before further operations

Fix up d3e7e8a630.

PR #17376.
adaptive-webui-19844
Chocobo1 2 years ago committed by GitHub
parent
commit
e281b667c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      src/base/settingsstorage.cpp

9
src/base/settingsstorage.cpp

@ -172,8 +172,12 @@ bool SettingsStorage::writeNativeSettings() const @@ -172,8 +172,12 @@ bool SettingsStorage::writeNativeSettings() const
nativeSettings->setValue(i.key(), i.value());
nativeSettings->sync(); // Important to get error status
const QSettings::Status status = nativeSettings->status();
const Path newPath {nativeSettings->fileName()};
nativeSettings.reset(); // close QSettings
switch (nativeSettings->status())
switch (status)
{
case QSettings::NoError:
break;
@ -188,8 +192,7 @@ bool SettingsStorage::writeNativeSettings() const @@ -188,8 +192,7 @@ bool SettingsStorage::writeNativeSettings() const
break;
}
const Path newPath {nativeSettings->fileName()};
if (nativeSettings->status() != QSettings::NoError)
if (status != QSettings::NoError)
{
Utils::Fs::removeFile(newPath);
return false;

Loading…
Cancel
Save