[ResourceLoader] Add check to prevent double free crashes.

This commit is contained in:
bruvzg 2024-08-06 08:31:03 +03:00
parent 3978628c6c
commit f5bb14dceb
No known key found for this signature in database
GPG Key ID: 7960FCF39844EC38
1 changed files with 5 additions and 2 deletions

View File

@ -408,7 +408,10 @@ void ResourceLoader::_thread_load_function(void *p_userdata) {
MessageQueue::set_thread_singleton_override(nullptr);
memdelete(own_mq_override);
}
memdelete(load_paths_stack);
if (load_paths_stack) {
memdelete(load_paths_stack);
load_paths_stack = nullptr;
}
}
}
@ -1304,7 +1307,7 @@ bool ResourceLoader::timestamp_on_load = false;
thread_local int ResourceLoader::load_nesting = 0;
thread_local WorkerThreadPool::TaskID ResourceLoader::caller_task_id = 0;
thread_local Vector<String> *ResourceLoader::load_paths_stack;
thread_local Vector<String> *ResourceLoader::load_paths_stack = nullptr;
thread_local HashMap<int, HashMap<String, Ref<Resource>>> ResourceLoader::res_ref_overrides;
template <>