diff options
Diffstat (limited to 'modules/gdscript/gdscript_cache.cpp')
-rw-r--r-- | modules/gdscript/gdscript_cache.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/modules/gdscript/gdscript_cache.cpp b/modules/gdscript/gdscript_cache.cpp index 2b1184bcb9..3b6526ffd9 100644 --- a/modules/gdscript/gdscript_cache.cpp +++ b/modules/gdscript/gdscript_cache.cpp @@ -135,8 +135,10 @@ void GDScriptParserRef::clear() { GDScriptParserRef::~GDScriptParserRef() { clear(); + if (!abandoned) { - GDScriptCache::remove_parser(path); + MutexLock lock(GDScriptCache::singleton->mutex); + GDScriptCache::singleton->parser_map.erase(path); } } @@ -153,15 +155,7 @@ void GDScriptCache::move_script(const String &p_from, const String &p_to) { return; } - if (singleton->parser_map.has(p_from) && !p_from.is_empty()) { - singleton->parser_map[p_to] = singleton->parser_map[p_from]; - } - singleton->parser_map.erase(p_from); - - if (singleton->parser_inverse_dependencies.has(p_from) && !p_from.is_empty()) { - singleton->parser_inverse_dependencies[p_to] = singleton->parser_inverse_dependencies[p_from]; - } - singleton->parser_inverse_dependencies.erase(p_from); + remove_parser(p_from); if (singleton->shallow_gdscript_cache.has(p_from) && !p_from.is_empty()) { singleton->shallow_gdscript_cache[p_to] = singleton->shallow_gdscript_cache[p_from]; |