1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-08 12:40:44 +00:00

Fix crash when saving resources with circular references

When saving resources, marking of already seen resources was
done too late, causing infinite loop traversing referenced resources
and eventual stack overflow. The change marks traversed resource
before descending to it's children, thus when this resource is
encountered again, it is already marked as seen and traversal stops.
This commit is contained in:
Maxim Kulkin
2023-02-17 05:18:58 -05:00
committed by Yuri Sizov
parent 0f7625ab46
commit 058604f5b8
3 changed files with 57 additions and 3 deletions

View File

@@ -1960,6 +1960,8 @@ void ResourceFormatSaverBinaryInstance::_find_resources(const Variant &p_variant
return;
}
resource_set.insert(res);
List<PropertyInfo> property_list;
res->get_property_list(&property_list);
@@ -1983,7 +1985,6 @@ void ResourceFormatSaverBinaryInstance::_find_resources(const Variant &p_variant
}
}
resource_set.insert(res);
saved_resources.push_back(res);
} break;