summaryrefslogtreecommitdiff
path: root/modules/gdscript/gdscript_function.cpp
diff options
context:
space:
mode:
authorkobewi <kobewi4e@gmail.com>2022-09-16 17:42:06 +0200
committerkobewi <kobewi4e@gmail.com>2022-12-02 00:20:11 +0100
commite9a3e49086d466e4beb3d8458149b58f5f6115bd (patch)
treea447d501705a8c27f8aae18c94281db10e7f4957 /modules/gdscript/gdscript_function.cpp
parentcd491c6e47bb41ccf596189676c0c5d4a72226cc (diff)
Cleanup function state connections when destroying instance
Co-authored-by: Adam Scott <ascott.ca@gmail.com>
Diffstat (limited to 'modules/gdscript/gdscript_function.cpp')
-rw-r--r--modules/gdscript/gdscript_function.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp
index 24a614b1ad..d167af576e 100644
--- a/modules/gdscript/gdscript_function.cpp
+++ b/modules/gdscript/gdscript_function.cpp
@@ -296,6 +296,15 @@ void GDScriptFunctionState::_clear_stack() {
}
}
+void GDScriptFunctionState::_clear_connections() {
+ List<Object::Connection> conns;
+ get_signals_connected_to_this(&conns);
+
+ for (Object::Connection &c : conns) {
+ c.signal.disconnect(c.callable);
+ }
+}
+
void GDScriptFunctionState::_bind_methods() {
ClassDB::bind_method(D_METHOD("resume", "arg"), &GDScriptFunctionState::resume, DEFVAL(Variant()));
ClassDB::bind_method(D_METHOD("is_valid", "extended_check"), &GDScriptFunctionState::is_valid, DEFVAL(false));