From 20548b7b248f2578a3fd45224b555546d8449c91 Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Tue, 1 Nov 2022 17:15:50 +0100 Subject: [PATCH] Fix mysterious UUID issue Turned out to be a remainant of previous code that stopped working correctly due to the changes --- libraries/shared/src/SettingManager.cpp | 19 ++++++++++++++----- libraries/shared/src/SettingManager.h | 2 -- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/libraries/shared/src/SettingManager.cpp b/libraries/shared/src/SettingManager.cpp index 823ebe7a18..571a6ddedb 100644 --- a/libraries/shared/src/SettingManager.cpp +++ b/libraries/shared/src/SettingManager.cpp @@ -136,14 +136,23 @@ namespace Setting { void Manager::saveSetting(Interface* handle) { const auto& key = handle->getKey(); - QVariant handleValue = UNSET_VALUE; + if (handle->isSet()) { - handleValue = handle->getVariant(); + QVariant handleValue = handle->getVariant(); + + withWriteLock([&] { + _settings[key] = handleValue; + }); + + emit valueChanged(key, handleValue); + } else { + withWriteLock([&] { + _settings.remove(key); + }); + + emit keyRemoved(key); } - withWriteLock([&] { - _settings[key] = handleValue; - }); } diff --git a/libraries/shared/src/SettingManager.h b/libraries/shared/src/SettingManager.h index 4bc141a71d..74c2fb93e7 100644 --- a/libraries/shared/src/SettingManager.h +++ b/libraries/shared/src/SettingManager.h @@ -210,8 +210,6 @@ namespace Setting { private: QHash _handles; - const QVariant UNSET_VALUE { QUuid::createUuid() }; - friend class Interface; friend class ::SettingsTests;