Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: OS.create_instance() should return -1 on failure #99694

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ public int onNewGodotInstanceRequested(String[] args) {
if (parentHost != null) {
return parentHost.onNewGodotInstanceRequested(args);
}
return 0;
return -1;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ default void onGodotRestartRequested(Godot instance) {}
* @return the id of the new instance. See {@code onGodotForceQuit}
*/
default int onNewGodotInstanceRequested(String[] args) {
return 0;
return -1;
}

/**
Expand Down
3 changes: 3 additions & 0 deletions platform/android/os_android.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down