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

Fix typed arrays of scripts not being decoded properly #731

Merged
merged 1 commit into from
Oct 11, 2024

Conversation

mihe
Copy link
Contributor

@mihe mihe commented Oct 8, 2024

Related to #699.

This is likely the same issue as what's mentioned here, which seems to stem from the fact that decode_TypedArray doesn't take into account all the forms that typed arrays can be encoded in.

Typed arrays can conditionally encode either a uint32_t as the type, if the array contains a built-in type, or a String if the array contains scripts of some kind, and decode_TypedArray currently only accounts for the former and not the latter.

This PR fixes this issue by incorporating not only HEADER_DATA_FIELD_TYPED_ARRAY_BUILTIN, but also HEADER_DATA_FIELD_TYPED_ARRAY_CLASS_NAME and HEADER_DATA_FIELD_TYPED_ARRAY_SCRIPT, as found here.

Similar to what's already being done, this also just discards this new script name/path.

@DaelonSuzuka
Copy link
Collaborator

Hey, thanks for investigating and submitting a fix! Could you share some example GDScript that breaks the existing code so I can test this?

@mihe
Copy link
Contributor Author

mihe commented Oct 9, 2024

Oh, yes, sorry!

It's as simple as declaring a custom resource (or presumably any type really) as class_name MyClass extends Resource and then declare a typed array member variable somewhere else as Array[MyClass]. Once you hit a breakpoint where that typed array is in scope then you'll see the error mentioned here and the Locals, Members and Globals lists in the debugger view will all be empty.

@DaelonSuzuka
Copy link
Collaborator

Awesome, I can confirm that this fixed it:

image

Thanks @mihe!

@DaelonSuzuka DaelonSuzuka merged commit 0a632d6 into godotengine:master Oct 11, 2024
4 checks passed
@mihe mihe deleted the typed-script-arrays branch October 11, 2024 15:14
@mihe
Copy link
Contributor Author

mihe commented Oct 11, 2024

Great to hear!

Any idea when there might be a new release cut with this included?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants