Cleanup function state connections when destroying instance
Co-authored-by: Adam Scott <ascott.ca@gmail.com>
This commit is contained in:
parent
cd491c6e47
commit
e9a3e49086
3 changed files with 22 additions and 2 deletions
|
|
@ -1483,7 +1483,12 @@ GDScript::~GDScript() {
|
|||
// Order matters since clearing the stack may already cause
|
||||
// the GDScriptFunctionState to be destroyed and thus removed from the list.
|
||||
pending_func_states.remove(E);
|
||||
E->self()->_clear_stack();
|
||||
GDScriptFunctionState *state = E->self();
|
||||
ObjectID state_id = state->get_instance_id();
|
||||
state->_clear_connections();
|
||||
if (ObjectDB::get_instance(state_id)) {
|
||||
state->_clear_stack();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1926,7 +1931,12 @@ GDScriptInstance::~GDScriptInstance() {
|
|||
// Order matters since clearing the stack may already cause
|
||||
// the GDSCriptFunctionState to be destroyed and thus removed from the list.
|
||||
pending_func_states.remove(E);
|
||||
E->self()->_clear_stack();
|
||||
GDScriptFunctionState *state = E->self();
|
||||
ObjectID state_id = state->get_instance_id();
|
||||
state->_clear_connections();
|
||||
if (ObjectDB::get_instance(state_id)) {
|
||||
state->_clear_stack();
|
||||
}
|
||||
}
|
||||
|
||||
if (script.is_valid() && owner) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue