summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorAlvin Wong <alvinhochun@gmail.com>2024-07-27 21:24:08 +0800
committerRémi Verschelde <rverschelde@gmail.com>2024-07-29 14:26:48 +0200
commitc9f44360733973e2bf8658acc4db0ce5e88a3dd2 (patch)
tree6ac7e92a4fd51512002abf44903cbdf8c631f683 /core
parent88d9325065a3e00e9e168ffad4ff93e12455a357 (diff)
downloadredot-engine-c9f44360733973e2bf8658acc4db0ce5e88a3dd2.tar.gz
Fix use-after-free in WorkerThreadPool
Diffstat (limited to 'core')
-rw-r--r--core/object/worker_thread_pool.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/object/worker_thread_pool.cpp b/core/object/worker_thread_pool.cpp
index a873bc1f09..56b9fa8475 100644
--- a/core/object/worker_thread_pool.cpp
+++ b/core/object/worker_thread_pool.cpp
@@ -83,6 +83,10 @@ void WorkerThreadPool::_process_task(Task *p_task) {
}
#endif
+#ifdef THREADS_ENABLED
+ bool low_priority = p_task->low_priority;
+#endif
+
if (p_task->group) {
// Handling a group
bool do_post = false;
@@ -159,7 +163,7 @@ void WorkerThreadPool::_process_task(Task *p_task) {
#ifdef THREADS_ENABLED
{
curr_thread.current_task = prev_task;
- if (p_task->low_priority) {
+ if (low_priority) {
low_priority_threads_used--;
if (_try_promote_low_priority_task()) {