Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

Avoid releasing main thread identity on platforms that don't need to drop it, making it a platform detail.

Lukas Tenbrink92cb8246a5b6
diff --git a/main/main.cpp b/main/main.cpp
index c2030487a35..8ebad33462f 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -2924,9 +2924,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
message_queue = memnew(MessageQueue);
- Thread::release_main_thread(); // If setup2() is called from another thread, that one will become main thread, so preventively release this one.
- set_current_thread_safe_for_nodes(false);
-
#if defined(STEAMAPI_ENABLED)
if (editor || project_manager) {
steam_tracker = memnew(SteamTracker);
diff --git a/platform/android/java_godot_lib_jni.cpp b/platform/android/java_godot_lib_jni.cpp
index 021067d1063..529ee33f131 100644
--- a/platform/android/java_godot_lib_jni.cpp
+++ b/platform/android/java_godot_lib_jni.cpp
@@ -50,6 +50,8 @@
#include "core/input/input.h"
#include "core/os/main_loop.h"
#include "core/os/os.h"
+#include "core/os/thread.h"
+#include "core/os/thread_safe.h"
#include "core/profiling/profiling.h"
#include "main/main.h"
#include "servers/camera/camera_server.h"
@@ -230,6 +232,9 @@ JNIEXPORT jboolean JNICALL Java_org_godotengine_godot_GodotLib_setup(JNIEnv *env
return false;
}
+ Thread::release_main_thread(); // setup2 will be called from another thread.
+ set_current_thread_safe_for_nodes(false);
+
TTS_Android::setup(p_godot_tts);
java_class_wrapper = memnew(JavaClassWrapper);