mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 07:18:08 +00:00
Properly release settings class before further operations
Fix up d3e7e8a630
.
PR #17376.
This commit is contained in:
parent
ce0e92e12a
commit
e281b667c6
@ -172,8 +172,12 @@ bool SettingsStorage::writeNativeSettings() const
|
|||||||
nativeSettings->setValue(i.key(), i.value());
|
nativeSettings->setValue(i.key(), i.value());
|
||||||
|
|
||||||
nativeSettings->sync(); // Important to get error status
|
nativeSettings->sync(); // Important to get error status
|
||||||
|
const QSettings::Status status = nativeSettings->status();
|
||||||
|
const Path newPath {nativeSettings->fileName()};
|
||||||
|
|
||||||
switch (nativeSettings->status())
|
nativeSettings.reset(); // close QSettings
|
||||||
|
|
||||||
|
switch (status)
|
||||||
{
|
{
|
||||||
case QSettings::NoError:
|
case QSettings::NoError:
|
||||||
break;
|
break;
|
||||||
@ -188,8 +192,7 @@ bool SettingsStorage::writeNativeSettings() const
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Path newPath {nativeSettings->fileName()};
|
if (status != QSettings::NoError)
|
||||||
if (nativeSettings->status() != QSettings::NoError)
|
|
||||||
{
|
{
|
||||||
Utils::Fs::removeFile(newPath);
|
Utils::Fs::removeFile(newPath);
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user