summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorPedro J. Estébanez <pedrojrulez@gmail.com>2023-06-07 19:40:30 +0200
committerPedro J. Estébanez <pedrojrulez@gmail.com>2023-06-08 09:54:41 +0200
commit543689eeed48c53839790d608f020c9888f7582b (patch)
treebc284d74040d064071fcb7e8b2775e7ba4c98026 /core
parent828ec2c5d005b6499c7c4c88beaf81767d05614b (diff)
downloadredot-engine-543689eeed48c53839790d608f020c9888f7582b.tar.gz
Mark thread name setup safe for nodes
Diffstat (limited to 'core')
-rw-r--r--core/core_bind.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/core_bind.cpp b/core/core_bind.cpp
index 8771aa88cc..193c41ded6 100644
--- a/core/core_bind.cpp
+++ b/core/core_bind.cpp
@@ -1187,7 +1187,11 @@ void Thread::_start_func(void *ud) {
ERR_FAIL_MSG(vformat("Could not call function '%s' on previously freed instance to start thread %s.", t->target_callable.get_method(), t->get_id()));
}
+ // Finding out a suitable name for the thread can involve querying a node, if the target is one.
+ // We know this is safe (unless the user is causing life cycle race conditions, which would be a bug on their part).
+ set_current_thread_safe_for_nodes(true);
String func_name = t->target_callable.is_custom() ? t->target_callable.get_custom()->get_as_text() : String(t->target_callable.get_method());
+ set_current_thread_safe_for_nodes(false);
::Thread::set_name(func_name);
// To avoid a circular reference between the thread and the script which can possibly contain a reference