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

Editor crashes while trying to generate docs for a GDExtension class #92018

Open
milothros opened this issue May 16, 2024 · 3 comments
Open

Editor crashes while trying to generate docs for a GDExtension class #92018

milothros opened this issue May 16, 2024 · 3 comments

Comments

@milothros
Copy link

Tested versions

v4.2.1.stable.official

System information

Godot v4.2.1.stable - Debian GNU/Linux 12 (bookworm) 12 - Wayland - Vulkan (Forward+) - dedicated AMD Radeon RX 580 Series (RADV POLARIS10) () - AMD Ryzen 5 3600 6-Core Processor (12 Threads)

Issue description

The editor crashes on startup while DocTools try to generate information about a property inside custom GDExtension class (if I haven't misinterpreted the backtrace). If the project is started explicitly (with the --path option) then everything works perfectly well and gdscript interprets the property.
The weirdest part is that this very property was handled fine previously. But after I made this GDExtension dependent on another one, it started crashing, and commenting out dependent code did not help.

Steps to reproduce

A simple GraphEdit property added to a godot::Object-derived class that's registered with ClassDB.

void Generator::_bind_methods()
    {
    godot::ClassDB::bind_method(godot::D_METHOD( "set_graph", "graph"), &Generator::set_graph);
    godot::ClassDB::bind_method(godot::D_METHOD( "get_graph"), &Generator::get_graph);
    //ADD_PROPERTY macro is the problem, setget methods work fine on their own and cause no editor crashes
    ADD_PROPERTY(godot::PropertyInfo(godot::Variant::OBJECT, "graph", godot::PROPERTY_HINT_NODE_TYPE, "GraphEdit"), "set_graph", "get_graph");
    }

Minimal reproduction project (MRP)

Verbose log of an appropriate version with the debug symbols enabled.

EditorSettings: Save OK!
Regenerating editor help cache
================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.2.1.stable.custom_build (b09f793f564a6c95dc76acc654b390e68441bd01)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /lib/x86_64-linux-gnu/libc.so.6(+0x3c050) [0x7fdf2a7c4050] (??:0)
[2] Variant::Variant(Object const*) (/home/gappy/gamedev/gtext/godot/core/variant/variant.cpp:2612)
[3] VariantTypeConstructor<Object*>::variant_from_type(void*, void*) (/home/gappy/gamedev/gtext/godot/./core/variant/variant_internal.h:1539)
[4] godot::Variant::Variant(godot::Object const*) at /home/gappy/gamedev/gtext/godot-cpp/src/variant/variant.cpp:189 //derived from gdextension library via 'addr2line'
[5] void godot::call_with_variant_args_ret_helper<godot::_gde_UnexistingClass, godot::GraphEdit*>(godot::_gde_UnexistingClass*, godot::GraphEdit* (godot::_gde_UnexistingClass::*)(), godot::Variant const**, godot::Variant&, GDExtensionCallError&, IndexSequence<>) (??:0)
[6] void godot::call_with_variant_args_ret_dv<godot::_gde_UnexistingClass, godot::GraphEdit*>(godot::_gde_UnexistingClass*, godot::GraphEdit* (godot::_gde_UnexistingClass::*)(), void const* const*, int, godot::Variant&, GDExtensionCallError&, std::vector<godot::Variant, std::allocator<godot::Variant> > const&) (??:0)
[7] godot::MethodBindTR<godot::GraphEdit*>::call(void*, void const* const*, long, GDExtensionCallError&) const (??:0)
[8] godot::MethodBind::bind_call(void*, void*, void const* const*, long, void*, GDExtensionCallError*) at /home/gappy/gamedev/gtext/godot-cpp/src/core/method_bind.cpp:99 //derived from gdextension library via 'addr2line'
[9] GDExtensionMethodBind::call(Object*, Variant const**, int, Callable::CallError&) const (/home/gappy/gamedev/gtext/godot/core/extension/gdextension.cpp:213)
[10] ClassDB::get_property(Object*, StringName const&, Variant&) (/home/gappy/gamedev/gtext/godot/core/object/class_db.cpp:1275)
[11] Object::get(StringName const&, bool*) const (/home/gappy/gamedev/gtext/godot/core/object/object.cpp:345)
[12] ClassDB::class_get_default_property_value(StringName const&, StringName const&, bool*) (/home/gappy/gamedev/gtext/godot/core/object/class_db.cpp:1700)
[13] /home/gappy/gamedev/gtext/godot/bin/godot.linuxbsd.editor.dev.x86_64.llvm(+0x6032182) [0x5574c971d182] (/home/gappy/gamedev/gtext/godot/editor/doc_tools.cpp:340)
[14] DocTools::generate(BitField<DocTools::GenerateFlags>) (/home/gappy/gamedev/gtext/godot/editor/doc_tools.cpp:497)
[15] EditorHelp::generate_doc(bool) (/home/gappy/gamedev/gtext/godot/editor/editor_help.cpp:2445)
[16] void call_with_variant_args_static<bool, 0ul>(void (*)(bool), Variant const**, Callable::CallError&, IndexSequence<0ul>) (/home/gappy/gamedev/gtext/godot/./core/variant/binder_common.h:781)
[17] void call_with_variant_args_static_ret<bool>(void (*)(bool), Variant const**, int, Variant&, Callable::CallError&) (/home/gappy/gamedev/gtext/godot/./core/variant/binder_common.h:847)
[18] CallableCustomStaticMethodPointerRet<void, bool>::call(Variant const**, int, Variant&, Callable::CallError&) const (/home/gappy/gamedev/gtext/godot/./core/object/callable_method_pointer.h:285)
[19] Callable::callp(Variant const**, int, Variant&, Callable::CallError&) const (/home/gappy/gamedev/gtext/godot/core/variant/callable.cpp:58)
[20] CallableCustomBind::call(Variant const**, int, Variant&, Callable::CallError&) const (/home/gappy/gamedev/gtext/godot/core/variant/callable_bind.cpp:145)
[21] Callable::callp(Variant const**, int, Variant&, Callable::CallError&) const (/home/gappy/gamedev/gtext/godot/core/variant/callable.cpp:58)
[22] CallQueue::_call_function(Callable const&, Variant const*, int, bool) (/home/gappy/gamedev/gtext/godot/core/object/message_queue.cpp:222)
[23] CallQueue::flush() (/home/gappy/gamedev/gtext/godot/core/object/message_queue.cpp:328)
[24] SceneTree::physics_process(double) (/home/gappy/gamedev/gtext/godot/scene/main/scene_tree.cpp:471)
[25] Main::iteration() (/home/gappy/gamedev/gtext/godot/main/main.cpp:3596)
[26] OS_LinuxBSD::run() (/home/gappy/gamedev/gtext/godot/platform/linuxbsd/os_linuxbsd.cpp:933)
[27] /home/gappy/gamedev/gtext/godot/bin/godot.linuxbsd.editor.dev.x86_64.llvm(main+0x1a0) [0x5574c8330010] (/home/gappy/gamedev/gtext/godot/platform/linuxbsd/godot_linuxbsd.cpp:76)
[28] /lib/x86_64-linux-gnu/libc.so.6(+0x2724a) [0x7fdf2a7af24a] (??:0)
[29] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x85) [0x7fdf2a7af305] (??:0)
[30] /home/gappy/gamedev/gtext/godot/bin/godot.linuxbsd.editor.dev.x86_64.llvm(_start+0x21) [0x5574c832fda1] (??:?)
-- END OF BACKTRACE --
================================================================
@AThousandShips
Copy link
Member

AThousandShips commented May 16, 2024

Can you try this on 4.2.2? Also what version of godot-cpp are you using?

It would also help if you upload some more details on how you set up your extension or some minimal code

@milothros
Copy link
Author

Adding custom classes as member objects to any other custom class crashes the editor on startup. This only happens in the GDExtension library that depends on another, even if the member is defined in the same extension.

class Generator : public godot::Resource
{
    GDCLASS( Generator, godot::Resource )
    
    godot::Node valid_godot_member_object;
    custom::Editor* valid_gdextension_member_pointer;
    
    custom::Editor invalid_member_object;
}

Those GDExtensions are compiled and linked with CMake.

target_link_libraries( generator_target
    PUBLIC
    godot-cpp
    antlr4-runtime
    grammar_target
    core_target
)

@AThousandShips
Copy link
Member

AThousandShips commented May 17, 2024

Is the other library built with the same exact version? Also what version of godot-cpp are you using?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants