godotengine / godotengine/godot-cpp
[GDNative] Godot::print and String() randomly change the input char*
- Dominant language
- C++
- Stars
- 2.7k
- Forks
- 809
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 8
Description
Both the `Godot::print(const char*)` and `String(const char*)`-methods randomly change the content of their input `const char*`.
Here's a minimal reproduction method:
```cpp
void SQLite::test(String input)
{
const CharString dummy_input = input.utf8();
const char *char_input = dummy_input.get_data();
std::cout << char_input << std::endl;
Godot::print(char_input);
std::cout << char_input << std::endl;
}
```
Code in Godot itself:
```gdscript
func _ready() -> void:
db = SQLite.new()
db.test("I love GDNative!")
```
Which prints in the console:
```
I love GDNative!
I love GDNative!
I love GDNative!
```
or
```
I love GDNative!
I love GDNative!
I
```
or
```
I love GDNative!
I love GDNative!
▐↕▬
```
or other similar random junk
Why is this happening? Am I not allowed to use char_input anymore after I print it?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.