1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

Move GDScript uninitialization to GDScriptLanguage::finalize()

Co-authored-by: Ricardo Buring <ricardo.buring@gmail.com>
Co-authored-by: kleonc <9283098+kleonc@users.noreply.github.com>
This commit is contained in:
Adam Scott
2022-12-02 13:27:26 -05:00
parent f3e6750a7e
commit 88f3045301
5 changed files with 61 additions and 47 deletions

View File

@@ -381,15 +381,15 @@ void GDScriptCache::clear_unreferenced_packed_scenes() {
}
}
GDScriptCache::GDScriptCache() {
singleton = this;
}
void GDScriptCache::clear() {
if (singleton == nullptr) {
return;
}
GDScriptCache::~GDScriptCache() {
destructing = true;
MutexLock lock(singleton->mutex);
RBSet<Ref<GDScriptParserRef>> parser_map_refs;
for (KeyValue<String, GDScriptParserRef *> &E : parser_map) {
for (KeyValue<String, GDScriptParserRef *> &E : singleton->parser_map) {
parser_map_refs.insert(E.value);
}
@@ -399,12 +399,20 @@ GDScriptCache::~GDScriptCache() {
}
parser_map_refs.clear();
parser_map.clear();
shallow_gdscript_cache.clear();
full_gdscript_cache.clear();
singleton->parser_map.clear();
singleton->shallow_gdscript_cache.clear();
singleton->full_gdscript_cache.clear();
packed_scene_cache.clear();
packed_scene_dependencies.clear();
singleton->packed_scene_cache.clear();
singleton->packed_scene_dependencies.clear();
}
GDScriptCache::GDScriptCache() {
singleton = this;
}
GDScriptCache::~GDScriptCache() {
destructing = true;
clear();
singleton = nullptr;
}