mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 16:23:39 +02:00
Merge pull request #9631 from AndrewMeadows/workaround-avatar-update-dos
Remove avatarEntityData cruft from settings
This commit is contained in:
commit
b34341b48e
2 changed files with 14 additions and 3 deletions
|
@ -795,6 +795,11 @@ void MyAvatar::saveData() {
|
|||
}
|
||||
settings.endArray();
|
||||
|
||||
if (_avatarEntityData.size() == 0) {
|
||||
// HACK: manually remove empty 'avatarEntityData' else deleted avatarEntityData may show up in settings file
|
||||
settings.remove("avatarEntityData");
|
||||
}
|
||||
|
||||
settings.beginWriteArray("avatarEntityData");
|
||||
int avatarEntityIndex = 0;
|
||||
auto hmdInterface = DependencyManager::get<HMDScriptingInterface>();
|
||||
|
@ -931,6 +936,10 @@ void MyAvatar::loadData() {
|
|||
updateAvatarEntity(entityID, properties);
|
||||
}
|
||||
settings.endArray();
|
||||
if (avatarEntityCount == 0) {
|
||||
// HACK: manually remove empty 'avatarEntityData' else legacy data may persist in settings file
|
||||
settings.remove("avatarEntityData");
|
||||
}
|
||||
setAvatarEntityDataChanged(true);
|
||||
|
||||
setDisplayName(settings.value("displayName").toString());
|
||||
|
|
|
@ -28,9 +28,10 @@ QString Settings::fileName() const {
|
|||
}
|
||||
|
||||
void Settings::remove(const QString& key) {
|
||||
if (key == "" || _manager->contains(key)) {
|
||||
_manager->remove(key);
|
||||
}
|
||||
// NOTE: you can't check _manager->contains(key) here because it will return 'false'
|
||||
// when the key is a valid child group with child keys.
|
||||
// However, calling remove() without checking will do the right thing.
|
||||
_manager->remove(key);
|
||||
}
|
||||
|
||||
QStringList Settings::childGroups() const {
|
||||
|
@ -46,6 +47,7 @@ QStringList Settings::allKeys() const {
|
|||
}
|
||||
|
||||
bool Settings::contains(const QString& key) const {
|
||||
// NOTE: this will return 'false' if key is a valid child group with child keys.
|
||||
return _manager->contains(key);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue