From 631d1e3a86fd3cfb32094951d311640418da68ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20J=2E=20Est=C3=A9banez?= Date: Mon, 8 Jan 2024 10:33:09 +0100 Subject: [PATCH] Let read thread guards allow access to out-of-tree nodes --- scene/main/node.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scene/main/node.h b/scene/main/node.h index cd1c31d784c..8130c61a341 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -558,7 +558,9 @@ public: _FORCE_INLINE_ bool is_readable_from_caller_thread() const { if (current_process_thread_group == nullptr) { // No thread processing. - return is_current_thread_safe_for_nodes(); + // Only accessible if node is outside the scene tree + // or access will happen from a node-safe thread. + return !data.inside_tree || is_current_thread_safe_for_nodes(); } else { // Thread processing. return true;