mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 23:17:02 +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();
|
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");
|
settings.beginWriteArray("avatarEntityData");
|
||||||
int avatarEntityIndex = 0;
|
int avatarEntityIndex = 0;
|
||||||
auto hmdInterface = DependencyManager::get<HMDScriptingInterface>();
|
auto hmdInterface = DependencyManager::get<HMDScriptingInterface>();
|
||||||
|
@ -931,6 +936,10 @@ void MyAvatar::loadData() {
|
||||||
updateAvatarEntity(entityID, properties);
|
updateAvatarEntity(entityID, properties);
|
||||||
}
|
}
|
||||||
settings.endArray();
|
settings.endArray();
|
||||||
|
if (avatarEntityCount == 0) {
|
||||||
|
// HACK: manually remove empty 'avatarEntityData' else legacy data may persist in settings file
|
||||||
|
settings.remove("avatarEntityData");
|
||||||
|
}
|
||||||
setAvatarEntityDataChanged(true);
|
setAvatarEntityDataChanged(true);
|
||||||
|
|
||||||
setDisplayName(settings.value("displayName").toString());
|
setDisplayName(settings.value("displayName").toString());
|
||||||
|
|
|
@ -28,9 +28,10 @@ QString Settings::fileName() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::remove(const QString& key) {
|
void Settings::remove(const QString& key) {
|
||||||
if (key == "" || _manager->contains(key)) {
|
// NOTE: you can't check _manager->contains(key) here because it will return 'false'
|
||||||
_manager->remove(key);
|
// 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 {
|
QStringList Settings::childGroups() const {
|
||||||
|
@ -46,6 +47,7 @@ QStringList Settings::allKeys() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Settings::contains(const QString& key) 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);
|
return _manager->contains(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue