fix bug which caused getValue for a non-existent key to return the integer 2

This commit is contained in:
Seth Alves 2016-08-04 10:16:08 -07:00
parent a1dc9beddb
commit 4c258b9568
2 changed files with 4 additions and 5 deletions

View file

@ -70,11 +70,10 @@ namespace Setting {
QVariant handleValue = UNSET_VALUE;
if (handle->isSet()) {
handleValue = handle->getVariant();
withWriteLock([&] {
_pendingChanges[key] = handleValue;
});
}
withWriteLock([&] {
_pendingChanges[key] = handleValue;
});
}
static const int SAVE_INTERVAL_MSEC = 5 * 1000; // 5 sec

View file

@ -46,7 +46,7 @@ namespace Setting {
private:
QHash<QString, Interface*> _handles;
QPointer<QTimer> _saveTimer = nullptr;
const QVariant UNSET_VALUE { QUuid::createUuid().variant() };
const QVariant UNSET_VALUE { QUuid::createUuid() };
QHash<QString, QVariant> _pendingChanges;
friend class Interface;