godotengine / godotengine/godot-cpp
godot-cpp String::split() incorrectly casting godot_array to PoolStringArray?
- Dominant language
- C++
- Stars
- 2.7k
- Forks
- 809
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 8
Description
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?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.