Fix heap-use-after-free when converting scene group to global

This commit is contained in:
Haoyu Qiu 2024-03-23 19:54:21 +08:00
parent fe01776f05
commit 4848bf4fd8
1 changed files with 7 additions and 3 deletions

View File

@ -157,10 +157,14 @@ void GroupsEditor::_update_groups() {
_load_scene_groups(scene_root_node);
for (const KeyValue<StringName, bool> &E : scene_groups) {
if (global_groups.has(E.key)) {
scene_groups.erase(E.key);
for (HashMap<StringName, bool>::Iterator E = scene_groups.begin(); E;) {
HashMap<StringName, bool>::Iterator next = E;
++next;
if (global_groups.has(E->key)) {
scene_groups.erase(E->key);
}
E = next;
}
updating_groups = false;