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

Fix crash when exporting improperly configured project. #35570

Merged

Conversation

markgarcia
Copy link
Contributor

Crash call stack:

Thread 1 "godot.x11.tools" received signal SIGSEGV, Segmentation fault.
0x000000000287dafa in EditorExportPlatformAndroid::_update_custom_build_project (this=0x7d65e70) at platform/android/export/export.cpp:1954
1954				f->store_string(new_file);

EditorExportPlatformAndroid::_update_custom_build_project(EditorExportPlatformAndroid * const this) (/home/mark/projects/godot/platform/android/export/export.cpp:1954)
EditorExportPlatformAndroid::export_project(EditorExportPlatformAndroid * const this, const Ref<EditorExportPreset> & p_preset, bool p_debug, const String & p_path, int p_flags) (/home/mark/projects/godot/platform/android/export/export.cpp:2062)
EditorExportPlatformAndroid::run(EditorExportPlatformAndroid * const this, const Ref<EditorExportPreset> & p_preset, int p_device, int p_debug_flags) (/home/mark/projects/godot/platform/android/export/export.cpp:1534)
EditorRunNative::_run_native(EditorRunNative * const this, int p_idx, int p_platform) (/home/mark/projects/godot/editor/editor_run_native.cpp:148)
MethodBind2<int, int>::call(MethodBind2<int, int> * const this, Object * p_object, const Variant ** p_args, int p_arg_count, Variant::CallError & r_error) (/home/mark/projects/godot/core/method_bind.gen.inc:1523)
Object::call(Object * const this, const StringName & p_method, const Variant ** p_args, int p_argcount, Variant::CallError & r_error) (/home/mark/projects/godot/core/object.cpp:921)
Object::emit_signal(Object * const this, const StringName & p_name, const Variant ** p_args, int p_argcount) (/home/mark/projects/godot/core/object.cpp:1217)
Object::emit_signal(Object * const this, const StringName & p_name, const Variant & p_arg1, const Variant & p_arg2, const Variant & p_arg3, const Variant & p_arg4, const Variant & p_arg5) (/home/mark/projects/godot/core/object.cpp:1274)
BaseButton::_pressed(BaseButton * const this) (/home/mark/projects/godot/scene/gui/base_button.cpp:135)
BaseButton::on_action_event(BaseButton * const this, Ref<InputEvent> p_event) (/home/mark/projects/godot/scene/gui/base_button.cpp:165)
BaseButton::_gui_input(BaseButton * const this, Ref<InputEvent> p_event) (/home/mark/projects/godot/scene/gui/base_button.cpp:64)
MenuButton::_gui_input(MenuButton * const this, Ref<InputEvent> p_event) (/home/mark/projects/godot/scene/gui/menu_button.cpp:67)
MethodBind1<Ref<InputEvent> >::call(MethodBind1<Ref<InputEvent> > * const this, Object * p_object, const Variant ** p_args, int p_arg_count, Variant::CallError & r_error) (/home/mark/projects/godot/core/method_bind.gen.inc:775)
Object::call_multilevel(Object * const this, const StringName & p_method, const Variant ** p_args, int p_argcount) (/home/mark/projects/godot/core/object.cpp:763)
Object::call_multilevel(Object * const this, const StringName & p_name, const Variant & p_arg1, const Variant & p_arg2, const Variant & p_arg3, const Variant & p_arg4, const Variant & p_arg5) (/home/mark/projects/godot/core/object.cpp:863)
Viewport::_gui_call_input(Viewport * const this, Control * p_control, const Ref<InputEvent> & p_input) (/home/mark/projects/godot/scene/main/viewport.cpp:1669)
Viewport::_gui_input_event(Viewport * const this, Ref<InputEvent> p_event) (/home/mark/projects/godot/scene/main/viewport.cpp:1979)
Viewport::input(Viewport * const this, const Ref<InputEvent> & p_event) (/home/mark/projects/godot/scene/main/viewport.cpp:2825)
Viewport::_vp_input(Viewport * const this, const Ref<InputEvent> & p_ev) (/home/mark/projects/godot/scene/main/viewport.cpp:1446)
MethodBind1<Ref<InputEvent> const&>::call(MethodBind1<Ref<InputEvent> const&> * const this, Object * p_object, const Variant ** p_args, int p_arg_count, Variant::CallError & r_error) (/home/mark/projects/godot/core/method_bind.gen.inc:775)

Also surface error message if can't export:
image

device_lock->lock();

EditorProgress ep("run", "Running on " + devices[p_device].name, 3);

String adb = EditorSettings::get_singleton()->get("export/android/adb");
if (adb == "") {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can_export() already checks for this.

@akien-mga
Copy link
Member

That should work, but IMO a better fix would be to test can_export() directly in EditorRunNative's NOTIFICATION_PROCESS, to automatically hide the button if the export is not possible (as done for the "Export" button in the project export dialog). That would fix the issue for all platforms and not just Android.

This would also allow to solve another issue that I noticed recently (but omitted to report), which is that the HTML5 quick export button is always visible, even if templates are missing.

@akien-mga
Copy link
Member

That being said, I'll merge this version for now as it seems to be a safe enough fix for the imminent 3.2 release. The fix for EditorRunNative might take some more time to figure out, so it can be done in a second step (undoing the then unnecessary can_export() check added by this PR).

@akien-mga akien-mga merged commit 58fac4c into godotengine:master Jan 26, 2020
@akien-mga
Copy link
Member

Thanks!

@akien-mga
Copy link
Member

I've now opened an issue about the possible follow-up and HTML5 one click deploy issue: #35592.

@markgarcia
Copy link
Contributor Author

Oh I honestly didn't notice I was just looking at Android-specific code. I could have looked at a higher level if only I've realized.

@markgarcia markgarcia deleted the fix-unconfigured-export-crash branch January 27, 2020 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants