summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2024-08-06 08:31:03 +0300
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2024-08-06 08:31:03 +0300
commitf5bb14dcebd6a48aafd04a3208b5d6ad8d52f072 (patch)
tree35ae70e646eae4680016cc4f8c8ed661f4c2c627 /core
parent3978628c6cc1227250fc6ed45c8d854d24c30c30 (diff)
downloadredot-engine-f5bb14dcebd6a48aafd04a3208b5d6ad8d52f072.tar.gz
[ResourceLoader] Add check to prevent double free crashes.
Diffstat (limited to 'core')
-rw-r--r--core/io/resource_loader.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp
index 2b5e83264e..c5582ad231 100644
--- a/core/io/resource_loader.cpp
+++ b/core/io/resource_loader.cpp
@@ -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 <>