浏览代码

Fix GDScript thread-exit routine assuming thread-enter was called

Pedro J. Estébanez 1 年之前
父节点
当前提交
cfa7e72057
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      modules/gdscript/gdscript.cpp

+ 6 - 0
modules/gdscript/gdscript.cpp

@@ -2106,6 +2106,12 @@ void GDScriptLanguage::thread_enter() {
 }
 
 void GDScriptLanguage::thread_exit() {
+	// This thread may have been created before GDScript was up
+	// (which also means it can't have run any GDScript code at all).
+	if (!GDScript::func_ptrs_to_update_thread_local) {
+		return;
+	}
+
 	GDScript::_fixup_thread_function_bookkeeping();
 
 	bool destroy = false;