Fix leak when function returning self type

Leak is caused by cyclic reference
This commit is contained in:
Ger Hean 2022-01-10 02:14:48 +08:00
parent 5a61822d7c
commit 609964848d
1 changed files with 1 additions and 1 deletions

View File

@ -2069,7 +2069,7 @@ GDScriptFunction *GDScriptCompiler::_parse_function(Error &r_error, GDScript *p_
if (p_func) { if (p_func) {
// if no return statement -> return type is void not unresolved Variant // if no return statement -> return type is void not unresolved Variant
if (p_func->body->has_return) { if (p_func->body->has_return) {
gd_function->return_type = _gdtype_from_datatype(p_func->get_datatype()); gd_function->return_type = _gdtype_from_datatype(p_func->get_datatype(), p_script);
} else { } else {
gd_function->return_type = GDScriptDataType(); gd_function->return_type = GDScriptDataType();
gd_function->return_type.has_type = true; gd_function->return_type.has_type = true;