| 2182 | } |
| 2183 | |
| 2184 | GDScriptInstance::~GDScriptInstance() { |
| 2185 | MutexLock lock(GDScriptLanguage::get_singleton()->mutex); |
| 2186 | |
| 2187 | while (SelfList<GDScriptFunctionState> *E = pending_func_states.first()) { |
| 2188 | // Order matters since clearing the stack may already cause |
| 2189 | // the GDSCriptFunctionState to be destroyed and thus removed from the list. |
| 2190 | pending_func_states.remove(E); |
| 2191 | GDScriptFunctionState *state = E->self(); |
| 2192 | ObjectID state_id = state->get_instance_id(); |
| 2193 | state->_clear_connections(); |
| 2194 | if (ObjectDB::get_instance(state_id)) { |
| 2195 | state->_clear_stack(); |
| 2196 | } |
| 2197 | } |
| 2198 | |
| 2199 | if (script.is_valid() && owner) { |
| 2200 | script->instances.erase(owner); |
| 2201 | } |
| 2202 | } |
| 2203 | |
| 2204 | /************* SCRIPT LANGUAGE **************/ |
| 2205 |
nothing calls this directly
no test coverage detected