From ef129aceddf63be8c312eb6441d4e1139a907bd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20J=2E=20Est=C3=A9banez?= Date: Thu, 25 Feb 2021 13:16:27 +0100 Subject: [PATCH] Prevent thread wait on itself for finish (cherry picked from commit afc5af8dfa7dd3076c7d6a347d96c81d82be88fe) --- core/os/thread.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/core/os/thread.cpp b/core/os/thread.cpp index ff1c03ca8e7..58b29b98024 100644 --- a/core/os/thread.cpp +++ b/core/os/thread.cpp @@ -92,6 +92,7 @@ bool Thread::is_started() const { void Thread::wait_to_finish() { if (id != 0) { + ERR_FAIL_COND_MSG(id == get_caller_id(), "A Thread can't wait for itself to finish."); thread.join(); std::thread empty_thread; thread.swap(empty_thread);