You've already forked godot
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user