Skip to content

A problem with the Ref #343

@RameshRavone

Description

@RameshRavone

Bare minimum of the file ai_script.cpp

void AIScript::_init() {
    _enabled = true;
    _source = Dictionary();
}

void AIScript::setSourceCode(String &p_source) {
    Ref<JSONParseResult> res = JSON::get_singleton()->parse(p_source);
    if (res->get_error() == Error::OK) {
        _source = res->get_result();
        emit_signal("changed");
    }
}

void AIScript::set_enabled(bool p_value) {
    ............

while ai_script.h is

class AIScript : public Resource {
    GODOT_CLASS(AIScript, Resource)

public:
    AIScript() {}

    void _init();
    Variant setSourceCode(String &p_source); 

And when I call Ref<AIScript> scr = AIScript::_new() following happens

handle_crash: Program crashed with signal 11
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /lib/x86_64-linux-gnu/libc.so.6(+0x46470) [0x7f7751676470] (??:0)
[2] godot() [0x2c39b50] (/home/rameshravone/Works/godot/./core/safe_refcount.h:107)
[3] godot() [0x2c39b0b] (/home/rameshravone/Works/godot/core/reference.cpp:37)
[4] godot() [0x2c3ade8] (/home/rameshravone/Works/godot/./core/method_ptrcall.h:104)
[5] /home/rameshravone/Works/GodotWorkspace/GDNative/TestBlank/demo/addons/test/libgodotai.so(+0x11f18a) [0x7f772c8b418a] (??:0)
[6] godot::Ref<godot::AIScript>::ref_pointer(godot::AIScript*) (??:0)
[7] SimpleClass::method(godot::Variant) (??:0)
[8] void godot::_WrappedMethod<SimpleClass, godot::Variant, godot::Variant>::apply<0>(godot::Variant*, SimpleClass*, godot::Variant**, godot::__Sequence<0>) (??:0)
[9] godot_variant godot::__wrapped_method<SimpleClass, godot::Variant, godot::Variant>(void*, void*, void*, int, godot_variant**) (??:0)
[10] godot() [0x961a42] (/home/rameshravone/Works/godot/modules/gdnative/nativescript/nativescript.cpp:719)
[11] godot() [0x2c02311] (/home/rameshravone/Works/godot/core/object.cpp:?)
[12] godot() [0x2cc9167] (/home/rameshravone/Works/godot/core/variant_call.cpp:?)
[13] godot() [0x5826f3] (/home/rameshravone/Works/godot/modules/gdscript/gdscript.h:435)
[14] godot() [0x50c419] (/home/rameshravone/Works/godot/./core/variant.h:418)
[15] godot() [0x202ecbb] (/home/rameshravone/Works/godot/scene/3d/spatial.h:54)
[16] godot() [0x2bfec5e] (/home/rameshravone/Works/godot/core/object.cpp:933)
[17] godot() [0x1b5af4d] (/home/rameshravone/Works/godot/./scene/scene_string_names.h:52)
[18] godot() [0x1b5af0b] (/home/rameshravone/Works/godot/scene/main/node.cpp:186)
[19] godot() [0x1b600fa] (/home/rameshravone/Works/godot/scene/main/node.cpp:2553)
[20] godot() [0x1b915ea] (/home/rameshravone/Works/godot/scene/main/scene_tree.cpp:465)
[21] godot() [0x456440] (/home/rameshravone/Works/godot/platform/x11/os_x11.cpp:3253)
[22] godot(main+0x99) [0x447c29] (/home/rameshravone/Works/godot/platform/x11/godot_x11.cpp:57)
[23] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0x7f77516571e3] (??:0)
[24] godot() [0x447ace] (??:?)
-- END OF BACKTRACE --
Aborted (core dumped)
make: *** [Makefile:10: rungame] Error 134

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions