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 return value and r_valid value in Variant::iter_init and Variant::iter_next #1253

Merged

Conversation

gilzoide
Copy link
Contributor

Variant iteration methods were returning wrong values from GDExtension API call, never reporting that iterations were valid.
This PR makes r_valid be set, as well as return the result from the call instead of returning valid.

Copy link
Collaborator

@dsnopek dsnopek left a comment

Choose a reason for hiding this comment

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

Thanks! The changes look good to me, and seem to work in my testing!

Attached is a patch that adds some automated tests to ensure that at least iter_init() is working correctly. (It's tricky to test iter_next(), because you shouldn't even be able to get to that point, if you're correctly checking r_valid on iter_init() - but your changes look correct anyway!) Unfortunately, the tests won't pass until PR godotengine/godot#83681 is fixed in Godot. So, I'll make a follow up PR later that adds these tests.

pr-1253-tests.txt

@dsnopek dsnopek added bug This has been identified as a bug cherrypick:4.1 labels Oct 20, 2023
@dsnopek dsnopek added this to the 4.x milestone Oct 20, 2023
@dsnopek dsnopek merged commit 0a6a19e into godotengine:master Oct 20, 2023
11 checks passed
@dsnopek
Copy link
Collaborator

dsnopek commented Oct 20, 2023

Thanks! Congrats on your first merged PR! 🎉

@gilzoide
Copy link
Contributor Author

Thanks for making up some tests to it! I had some trouble running tests on my machine (can't remember exactly what they were now), so I opened the PR without any and left them for later. Aaaand totally forgot about it 😅

@gilzoide gilzoide deleted the fix-variant-iteration-valid-flag branch October 22, 2023 11:16
@dsnopek
Copy link
Collaborator

dsnopek commented Oct 23, 2023

Cherry-picked for 4.1 in PR #1281

@akien-mga akien-mga modified the milestones: 4.x, 4.2 Oct 24, 2023
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

Successfully merging this pull request may close these issues.

3 participants