summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Snopek <dsnopek@gmail.com>2024-11-25 15:58:06 -0600
committerDavid Snopek <dsnopek@gmail.com>2024-11-25 15:58:06 -0600
commit38e0532ffa43a8302a32d683ec7610b21ec0f4a1 (patch)
treecd3074244705449ef5030bc968c7d74dd5522044
parentd09d82d433b03bb3773fd2a8cc8d6ccc2f8739ce (diff)
downloadredot-engine-38e0532ffa43a8302a32d683ec7610b21ec0f4a1.tar.gz
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;
}