Skip to content

Commit b36885c

Browse files
committed
Merge pull request #95186 from bruvzg/thr_load_dbl_free
[ResourceLoader] Add check to prevent double free crashes.
2 parents 6a10330 + f5bb14d commit b36885c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

core/io/resource_loader.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,10 @@ void ResourceLoader::_thread_load_function(void *p_userdata) {
408408
MessageQueue::set_thread_singleton_override(nullptr);
409409
memdelete(own_mq_override);
410410
}
411-
memdelete(load_paths_stack);
411+
if (load_paths_stack) {
412+
memdelete(load_paths_stack);
413+
load_paths_stack = nullptr;
414+
}
412415
}
413416
}
414417

@@ -1304,7 +1307,7 @@ bool ResourceLoader::timestamp_on_load = false;
13041307

13051308
thread_local int ResourceLoader::load_nesting = 0;
13061309
thread_local WorkerThreadPool::TaskID ResourceLoader::caller_task_id = 0;
1307-
thread_local Vector<String> *ResourceLoader::load_paths_stack;
1310+
thread_local Vector<String> *ResourceLoader::load_paths_stack = nullptr;
13081311
thread_local HashMap<int, HashMap<String, Ref<Resource>>> ResourceLoader::res_ref_overrides;
13091312

13101313
template <>

0 commit comments

Comments
 (0)