Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GDNative] Godot::print and String() randomly change the input char* #829

Open
2shady4u opened this issue Sep 4, 2022 · 1 comment
Open
Labels
bug This has been identified as a bug

Comments

@2shady4u
Copy link
Contributor

2shady4u commented Sep 4, 2022

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:

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

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?

@2shady4u
Copy link
Contributor Author

2shady4u commented Sep 4, 2022

Might be related? godotengine/godot#40957

@Calinou Calinou added the bug This has been identified as a bug label Sep 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This has been identified as a bug
Projects
None yet
Development

No branches or pull requests

2 participants