From 213b6e316c99a34de844803a825814bb4d9c1525 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Tue, 4 Jul 2023 19:11:53 +0800 Subject: [PATCH] Don't emit superfluous signal `Preferences::apply()` might emit superfluous changed signal even when the settings hasn't changed (e.g. not dirty), this commit fixes it. --- src/base/settingsstorage.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/base/settingsstorage.cpp b/src/base/settingsstorage.cpp index e2009ed6d..b4bbd9605 100644 --- a/src/base/settingsstorage.cpp +++ b/src/base/settingsstorage.cpp @@ -79,8 +79,10 @@ SettingsStorage *SettingsStorage::instance() bool SettingsStorage::save() { + // return `true` only when settings is different AND is saved successfully + const QWriteLocker locker(&m_lock); // guard for `m_dirty` too - if (!m_dirty) return true; + if (!m_dirty) return false; if (!writeNativeSettings()) {