mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-11-22 00:48:09 +01:00
Backport 65910 for Godot 3
This commit is contained in:
parent
b0701da063
commit
3fe6da64d4
@ -84,7 +84,12 @@ void GDScript::_clear_pending_func_states() {
|
|||||||
// Order matters since clearing the stack may already cause
|
// Order matters since clearing the stack may already cause
|
||||||
// the GDSCriptFunctionState to be destroyed and thus removed from the list.
|
// the GDSCriptFunctionState to be destroyed and thus removed from the list.
|
||||||
pending_func_states.remove(E);
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
GDScriptLanguage::get_singleton()->lock.unlock();
|
GDScriptLanguage::get_singleton()->lock.unlock();
|
||||||
}
|
}
|
||||||
@ -1339,7 +1344,12 @@ GDScriptInstance::~GDScriptInstance() {
|
|||||||
// Order matters since clearing the stack may already cause
|
// Order matters since clearing the stack may already cause
|
||||||
// the GDSCriptFunctionState to be destroyed and thus removed from the list.
|
// the GDSCriptFunctionState to be destroyed and thus removed from the list.
|
||||||
pending_func_states.remove(E);
|
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) {
|
if (script.is_valid() && owner) {
|
||||||
|
@ -1859,6 +1859,15 @@ void GDScriptFunctionState::_clear_stack() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GDScriptFunctionState::_clear_connections() {
|
||||||
|
List<Object::Connection> conns;
|
||||||
|
get_signals_connected_to_this(&conns);
|
||||||
|
for (List<Object::Connection>::Element *E = conns.front(); E; E = E->next()) {
|
||||||
|
Object::Connection &c = E->get();
|
||||||
|
c.source->disconnect(c.signal, c.target, c.method);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GDScriptFunctionState::_bind_methods() {
|
void GDScriptFunctionState::_bind_methods() {
|
||||||
ClassDB::bind_method(D_METHOD("resume", "arg"), &GDScriptFunctionState::resume, DEFVAL(Variant()));
|
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));
|
ClassDB::bind_method(D_METHOD("is_valid", "extended_check"), &GDScriptFunctionState::is_valid, DEFVAL(false));
|
||||||
|
@ -374,6 +374,7 @@ public:
|
|||||||
Variant resume(const Variant &p_arg = Variant());
|
Variant resume(const Variant &p_arg = Variant());
|
||||||
|
|
||||||
void _clear_stack();
|
void _clear_stack();
|
||||||
|
void _clear_connections();
|
||||||
|
|
||||||
GDScriptFunctionState();
|
GDScriptFunctionState();
|
||||||
~GDScriptFunctionState();
|
~GDScriptFunctionState();
|
||||||
|
Loading…
Reference in New Issue
Block a user