Open 2shady4u opened 2 years ago
Both the Godot::print(const char*) and String(const char*)-methods randomly change the content of their input const char*.
Godot::print(const char*)
String(const char*)
const char*
Here's a minimal reproduction method:
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:
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
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?
Might be related? https://github.com/godotengine/godot/issues/40957
Both the
Godot::print(const char*)
andString(const char*)
-methods randomly change the content of their inputconst char*
.Here's a minimal reproduction method:
Code in Godot itself:
Which prints in the console:
or
or
or other similar random junk
Why is this happening? Am I not allowed to use char_input anymore after I print it?