瀏覽代碼

Let read thread guards allow access to out-of-tree nodes

Pedro J. Estébanez 1 年之前
父節點
當前提交
631d1e3a86
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      scene/main/node.h

+ 3 - 1
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;