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

C#: Fix SendToScriptDebugger crash #77377

Merged
merged 1 commit into from
May 23, 2023

Conversation

RedworkDE
Copy link
Member

@RedworkDE RedworkDE commented May 22, 2023

Such a stupid error, it was so close to working correctly.

(On x64:)
The native code returned a bool as a single byte in the al register, leaving the rest of the a register whatever garbage it was before, but the native to managed transition interpreted the return value as a 4 byte bool in eax, which was mostly filled with garbage and thus not 0 (false) as intended.
Somehow on dev build none of this matters and the engine just doesn't crash hiding the issue.

With this patch the return value is correctly interpreted as a single byte value on the C# side.

Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me.

@neikeq
Copy link
Contributor

neikeq commented May 23, 2023

I'm thinking in the future we should make the internal calls source generator detect mistakes like this, or automatically do the conversion to godot_bool.

@akien-mga akien-mga merged commit ea5322f into godotengine:master May 23, 2023
@akien-mga
Copy link
Member

Thanks!

@YuriSizov
Copy link
Contributor

Cherry-picked for 4.0.4. That's a big one, nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment