1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-28 16:07:14 +00:00

WorkerThreadPool: Fix thread message queue not restored after overridden in a task

Also, simplifies the thread override teardown in MessageQueue.
This commit is contained in:
Pedro J. Estébanez
2024-06-13 10:14:14 +02:00
parent 475248d99d
commit 21c03d1956
3 changed files with 5 additions and 5 deletions

View File

@@ -481,10 +481,7 @@ CallQueue::~CallQueue() {
if (!allocator_is_custom) {
memdelete(allocator);
}
// This is done here to avoid a circular dependency between the safety checks and the thread singleton pointer.
if (this == MessageQueue::thread_singleton) {
MessageQueue::thread_singleton = nullptr;
}
DEV_ASSERT(!is_current_thread_override);
}
//////////////////////
@@ -493,7 +490,6 @@ CallQueue *MessageQueue::main_singleton = nullptr;
thread_local CallQueue *MessageQueue::thread_singleton = nullptr;
void MessageQueue::set_thread_singleton_override(CallQueue *p_thread_singleton) {
DEV_ASSERT(p_thread_singleton); // To unset the thread singleton, don't call this with nullptr, but just memfree() it.
#ifdef DEV_ENABLED
if (thread_singleton) {
thread_singleton->is_current_thread_override = false;