summaryrefslogtreecommitdiff
path: root/modules/gdscript/gdscript_function.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-11-18 23:08:01 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-11-18 23:08:01 +0100
commit80b3813b1505a6bd195c0b0aac1555a7969e59c9 (patch)
tree26f4adcebb64ec985f6193e73d7adb45b9c8965d /modules/gdscript/gdscript_function.cpp
parenta66fc4cf7ebd155ee475bc69863b47081119d965 (diff)
parent5704055d30499cc63672d44001760a98abfbfc08 (diff)
Merge pull request #67714 from adamscott/fix-preload-cyclic-references-part2
Fix cyclic references in GDScript 2.0
Diffstat (limited to 'modules/gdscript/gdscript_function.cpp')
-rw-r--r--modules/gdscript/gdscript_function.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp
index 98b3e40f1b..24a614b1ad 100644
--- a/modules/gdscript/gdscript_function.cpp
+++ b/modules/gdscript/gdscript_function.cpp
@@ -149,10 +149,17 @@ GDScriptFunction::GDScriptFunction() {
}
GDScriptFunction::~GDScriptFunction() {
+ get_script()->member_functions.erase(name);
+
for (int i = 0; i < lambdas.size(); i++) {
memdelete(lambdas[i]);
}
+ for (int i = 0; i < argument_types.size(); i++) {
+ argument_types.write[i].script_type_ref = Ref<Script>();
+ }
+ return_type.script_type_ref = Ref<Script>();
+
#ifdef DEBUG_ENABLED
MutexLock lock(GDScriptLanguage::get_singleton()->mutex);