godotengine / godotengine/godot-cpp

EditorInspectorPlugin causes a crash when adding an element to an exported array in the inspector

Open
#886 0 comments 0 reactions 0 assignees View on GitHub
bug topic:gdextension
Dominant language
C++
Stars
2.7k
Forks
809
Avg merge
1d 3h
Merged PRs (30d)
8

Description

Godot Engine v4.0.beta.custom_build (bbac8198f89c0cbf0da4293201e54aa847947370), macOS 12.3, clang

Not sure this is a godot or godot-cpp issue.

Repro:
1) Create a class that extends EditorInspectorPlugin and override `_parse_property` (only happens when this function is overridden).
2) In Godot create an addon and add the plugin to the project with `add_inspector_plugin`.
3) In any script, export an Array: `@export var test:Array`.
4) In the inspector add an element to the array with the "Add Element" or arrow button in the property.
5) Crash

The EditorInspectorPlugin otherwise works fine in my project. Here I used the test project located in this repo and added the class below. [Demo project](https://github.com/godotengine/godot-cpp/files/9740098/demo.zip) to experience the crash (macOS, exported array added to the main.gd example).

```
class TestPlugin : public EditorInspectorPlugin
{
GDCLASS(TestPlugin, EditorInspectorPlugin);

protected:
static void _bind_methods() {}

public:
virtual bool _parse_property(Object* object, int64_t type, const String& name, int64_t hint_type,
const String& hint_string, int64_t usage_flags, bool wide) override {
return false;
}
};
```

```
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.0.beta.custom_build (bbac8198f89c0cbf0da4293201e54aa847947370)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] 1 libsystem_platform.dylib 0x00007ff80cc6fdfd _sigtramp + 29
[2] 2 ??? 0x0000000000000008 0x0 + 8
[3] std::__1::mutex::lock()
[4] Object::get_instance_binding(void*, GDNativeInstanceBindingCallbacks const*) (in godot) (object.cpp:1715)
[5] gdnative_object_get_instance_binding(void*, void*, GDNativeInstanceBindingCallbacks const*) (in godot) (gdnative_interface.cpp:845)
[6] void godot::call_with_ptr_args_ret_helper(TestPlugin*, bool (TestPlugin::*)(godot::Object*, long long, godot::String const&, long long, godot::String const&, long long, bool), void* const*, void*, IndexSequence<0ul, 1ul, 2ul, 3ul, 4ul, 5ul, 6ul>)
[7] void godot::call_with_ptr_args(TestPlugin*, bool (TestPlugin::*)(godot::Object*, long long, godot::String const&, long long, godot::String const&, long long, bool), void* const*, void*)
[8] void godot::EditorInspectorPlugin::register_virtuals()::'lambda0'(void*, void* const*, void*)::operator()(void*, void* const*, void*) const
[9] void godot::EditorInspectorPlugin::register_virtuals()::'lambda0'(void*, void* const*, void*)::__invoke(void*, void* const*, void*)
[10] bool EditorInspectorPlugin::_gdvirtual__parse_property_call(Object*, int, String, int, String, int, bool, bool&) (in godot) (editor_inspector.h:232)
[11] EditorInspectorPlugin::parse_property(Object*, Variant::Type, String const&, PropertyHint, String const&, unsigned int, bool) (in godot) (editor_inspector.cpp:1085)
[12] EditorInspector::instantiate_property_editor(Object*, Variant::Type, String const&, PropertyHint, String const&, unsigned int, bool) (in godot) (editor_inspector.cpp:2451)
[13] EditorPropertyArray::update_property() (in godot) (editor_properties_array_dict.cpp:354)
[14] EditorPropertyArray::_length_changed(double) (in godot) (editor_properties_array_dict.cpp:593)
[15] void call_with_variant_args_helper(EditorPropertyArray*, void (EditorPropertyArray::*)(double), Variant const**, Callable::CallError&, IndexSequence<0ul>) (in godot) (binder_common.h:267)
[16] void call_with_variant_args(EditorPropertyArray*, void (EditorPropertyArray::*)(double), Variant const**, int, Callable::CallError&) (in godot) (binder_common.h:377)
[17] CallableCustomMethodPointer::call(Variant const**, int, Variant&, Callable::CallError&) const (in godot) (callable_method_pointer.h:105)
[18] Callable::callp(Variant const**, int, Variant&, Callable::CallError&) const (in godot) (callable.cpp:51)
[19] Object::emit_signalp(StringName const&, Variant const**, int) (in godot) (object.cpp:1045)
[20] Error Object::emit_signal(StringName const&, double) (in godot) (object.h:851)
[21] Range::_value_changed_notify() (in godot) (range.cpp:48)
[22] Range::Shared::emit_value_changed() (in godot) (range.cpp:53)
[23] Range::set_value(double) (in godot) (range.cpp:106)
[24] EditorSpinSlider::gui_input(Ref const&) (in godot) (editor_spin_slider.cpp:68)
[25] Control::_call_gui_input(Ref const&) (in godot) (control.cpp:1719)
[26] Viewport::_gui_call_input(Control*, Ref const&) (in godot) (viewport.cpp:1322)
[27] Viewport::_gui_input_event(Ref) (in godot) (viewport.cpp:1560)
[28] Viewport::push_input(Ref const&, bool) (in godot) (viewport.cpp:2776)
[29] Window::_window_input(Ref const&) (in godot) (window.cpp:1096)
[30] void call_with_variant_args_helper const&, 0ul>(Window*, void (Window::*)(Ref const&), Variant const**, Callable::CallError&, IndexSequence<0ul>) (in godot) (binder_common.h:262)
[31] void call_with_variant_args const&>(Window*, void (Window::*)(Ref const&), Variant const**, int, Callable::CallError&) (in godot) (binder_common.h:377)
[32] CallableCustomMethodPointer const&>::call(Variant const**, int, Variant&, Callable::CallError&) const (in godot) (callable_method_pointer.h:105)
[33] Callable::callp(Variant const**, int, Variant&, Callable::CallError&) const (in godot) (callable.cpp:51)
[34] DisplayServerMacOS::_dispatch_input_event(Ref const&) (in godot) (display_server_macos.mm:365)
[35] DisplayServerMacOS::_dispatch_input_events(Ref const&) (in godot) (display_server_macos.mm:332)
[36] Input::_parse_input_event_impl(Ref const&, bool) (in godot) (input.cpp:661)
[37] Input::flush_buffered_events() (in godot) (input.cpp:883)
[38] DisplayServerMacOS::process_events() (in godot) (display_server_macos.mm:3295)
[39] OS_MacOS::run() (in godot) (os_macos.mm:535)
[40] main (in godot) (godot_main_macos.mm:86)
[41] 41 dyld 0x0000000127bfa51e start + 462
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.