summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThaddeus Crews <repiteo@outlook.com>2024-11-27 10:47:30 -0600
committerThaddeus Crews <repiteo@outlook.com>2024-11-27 10:47:30 -0600
commit150c69c0f24adebb92887743c1a6bb3505003e25 (patch)
treefcbebbb296514d7b67b4ab62df2fb3de955766f1
parented01f5f2aa8e5a4c7103417f78259c5c9d9471ff (diff)
parent38e0532ffa43a8302a32d683ec7610b21ec0f4a1 (diff)
downloadredot-engine-150c69c0f24adebb92887743c1a6bb3505003e25.tar.gz
Merge pull request #99694 from dsnopek/android-os-create-instance-return-value
Android: `OS.create_instance()` should return `-1` on failure
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/Godot.kt2
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/GodotFragment.java2
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/GodotHost.java2
-rw-r--r--platform/android/os_android.cpp3
4 files changed, 6 insertions, 3 deletions
diff --git a/platform/android/java/lib/src/org/godotengine/godot/Godot.kt b/platform/android/java/lib/src/org/godotengine/godot/Godot.kt
index 3ad8e6bc9e..f82b44c544 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/Godot.kt
+++ b/platform/android/java/lib/src/org/godotengine/godot/Godot.kt
@@ -1123,7 +1123,7 @@ class Godot(private val context: Context) {
@Keep
private fun createNewGodotInstance(args: Array<String>): Int {
- return primaryHost?.onNewGodotInstanceRequested(args) ?: 0
+ return primaryHost?.onNewGodotInstanceRequested(args) ?: -1
}
@Keep
diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotFragment.java b/platform/android/java/lib/src/org/godotengine/godot/GodotFragment.java
index d60595c0bb..7cfe3ef3e8 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/GodotFragment.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/GodotFragment.java
@@ -474,7 +474,7 @@ public class GodotFragment extends Fragment implements IDownloaderClient, GodotH
if (parentHost != null) {
return parentHost.onNewGodotInstanceRequested(args);
}
- return 0;
+ return -1;
}
@Override
diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotHost.java b/platform/android/java/lib/src/org/godotengine/godot/GodotHost.java
index 344b73f799..60d1f01b21 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/GodotHost.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/GodotHost.java
@@ -92,7 +92,7 @@ public interface GodotHost {
* @return the id of the new instance. See {@code onGodotForceQuit}
*/
default int onNewGodotInstanceRequested(String[] args) {
- return 0;
+ return -1;
}
/**
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp
index 7b0d3a29e9..06f5df4871 100644
--- a/platform/android/os_android.cpp
+++ b/platform/android/os_android.cpp
@@ -863,6 +863,9 @@ Error OS_Android::create_process(const String &p_path, const List<String> &p_arg
Error OS_Android::create_instance(const List<String> &p_arguments, ProcessID *r_child_id) {
int instance_id = godot_java->create_new_godot_instance(p_arguments);
+ if (instance_id == -1) {
+ return FAILED;
+ }
if (r_child_id) {
*r_child_id = instance_id;
}