diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2023-02-03 16:13:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-03 16:13:06 +0100 |
commit | 604493eb6ee3def65aca089c1d4bc71ea03ca19a (patch) | |
tree | 910adcfd1435a0297e6c5c7b05b2b538e8cc8e0d /modules/gdscript/gdscript_function.cpp | |
parent | eb91e909a7e2a4d905b1511de9cb53d949df82fc (diff) | |
parent | e9a3e49086d466e4beb3d8458149b58f5f6115bd (diff) | |
download | redot-engine-604493eb6ee3def65aca089c1d4bc71ea03ca19a.tar.gz |
Merge pull request #65910 from KoBeWi/gdsus
Cleanup function state connections when destroying instance
Diffstat (limited to 'modules/gdscript/gdscript_function.cpp')
-rw-r--r-- | modules/gdscript/gdscript_function.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp index 71831a3a97..a6b4dc7981 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)); |