1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-02-03 18:34:28 +00:00

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.
This commit is contained in:
Chocobo1 2023-07-04 19:11:53 +08:00
parent ffc3d8d345
commit 213b6e316c
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C

View File

@ -79,8 +79,10 @@ SettingsStorage *SettingsStorage::instance()
bool SettingsStorage::save() bool SettingsStorage::save()
{ {
// return `true` only when settings is different AND is saved successfully
const QWriteLocker locker(&m_lock); // guard for `m_dirty` too const QWriteLocker locker(&m_lock); // guard for `m_dirty` too
if (!m_dirty) return true; if (!m_dirty) return false;
if (!writeNativeSettings()) if (!writeNativeSettings())
{ {