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:
parent
0f7625ab46
commit
058604f5b8
3 changed files with 57 additions and 3 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue