Skip to content
Permalink
Browse files

Clean up SettingsStorage::save()

Also it should return `true` when `m_dirty` is `false`.
  • Loading branch information...
Chocobo1 committed Sep 8, 2019
1 parent e7e5ee1 commit 0a959bcbe7693f78a81fb4481bf54a0bf77f60dc
Showing with 8 additions and 8 deletions.
  1. +8 −8 src/base/settingsstorage.cpp
@@ -186,18 +186,18 @@ SettingsStorage *SettingsStorage::instance()

bool SettingsStorage::save()
{
if (!m_dirty) return false; // Obtaining the lock is expensive, let's check early
const QWriteLocker locker(&m_lock);
if (!m_dirty) return false; // something might have changed while we were getting the lock
if (!m_dirty) return true; // Obtaining the lock is expensive, let's check early
const QWriteLocker locker(&m_lock); // to guard for `m_dirty`
if (!m_dirty) return true; // something might have changed while we were getting the lock

const TransactionalSettings settings(QLatin1String("qBittorrent"));
if (settings.write(m_data)) {
m_dirty = false;
return true;
if (!settings.write(m_data)) {
m_timer.start();
return false;
}

m_timer.start();
return false;
m_dirty = false;
return true;
}

QVariant SettingsStorage::loadValue(const QString &key, const QVariant &defaultValue) const

0 comments on commit 0a959bc

Please sign in to comment.
You can’t perform that action at this time.