Skip to content

godot-cpp String::split() incorrectly casting godot_array to PoolStringArray? #144

Open
@paulmenage

Description

@paulmenage

Trying to use String.split() from C++ GDNative resulted in crashes when trying to access the values, and bogus size() values.

It looks like godot-cpp/src/core/String.cpp is directly casting a godot_array into a PoolStringArray, which AFAICS are distinct types - shouldn't it be doing something more like this (which does appear to do the right thing for me)?

    godot_array arr = godot::api->godot_string_split(&_godot_string, &divisor._godot_string);
    godot_pool_string_array result;
    godot::api->godot_pool_string_array_new_with_array(&result, &arr);
    godot::api->godot_array_destroy(&arr);
    return *(PoolStringArray *)&result;

Or even better, godot_string_split() should be returning a real pool_array to start with?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis has been identified as a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions