summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-11-27 16:01:55 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-11-27 16:01:55 +0100
commitb3a0e077ebd29bc4e2456dea816b525b691932ab (patch)
tree2f521ea4c0809664b7ef64d1a95d7d217938d479
parenta807d4bfa79f7308ad87d78002269a05b0a4841b (diff)
parentcfa7e72057c7728e01fbf3f492b28174c06f9e85 (diff)
downloadredot-engine-b3a0e077ebd29bc4e2456dea816b525b691932ab.tar.gz
Merge pull request #85432 from RandomShaper/fix_gds_exit_crash_lower
Fix GDScript thread-exit routine assuming thread-enter was called
-rw-r--r--modules/gdscript/gdscript.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index 05c2558417..87f21bf568 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/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;