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 comparison of Callables from callable_mp() of the same method #1294

Merged
merged 1 commit into from
Nov 17, 2023

Conversation

dsnopek
Copy link
Collaborator

@dsnopek dsnopek commented Nov 2, 2023

Fixes #1293

This duplicates a lot of code from custom_method_pointer.h/cpp in Godot. I finally understand why it does what it does in such a weird way. :-) The tl;dr version is that the size of C++ method pointers in undefined (as opposed to function pointers, which do have a defined size), so putting them in a struct and then looping over the data for comparison and hashes is the easiest, portable way to do that.

Marking this as a draft for now, because it depends on PR #1280 which isn't merged yet

@dsnopek dsnopek added the bug This has been identified as a bug label Nov 2, 2023
@dsnopek dsnopek added this to the 4.x milestone Nov 2, 2023
@dsnopek dsnopek requested a review from a team as a code owner November 2, 2023 20:25
@dsnopek dsnopek marked this pull request as draft November 2, 2023 20:25
@dsnopek dsnopek force-pushed the is-connected branch 2 times, most recently from 8c953dd to 2810d65 Compare November 6, 2023 06:10
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.

Looks good to me.

@akien-mga akien-mga changed the title Fix comparison of Callables from callable_mp() of the same method Fix comparison of Callables from callable_mp() of the same method Nov 16, 2023
@dsnopek dsnopek marked this pull request as ready for review November 17, 2023 18:49
@dsnopek
Copy link
Collaborator Author

dsnopek commented Nov 17, 2023

Per @maiself's note from the GDExtension meeting, I removed the comments about hashing that got copy-pasted from Godot.

I think I'm going to go ahead and merge this one: It's a bug fix. There's tests that show the bug is fixed. And the code itself is primarily copy-pasted from Godot.

@dsnopek dsnopek merged commit 8d17966 into godotengine:master Nov 17, 2023
12 checks passed
@akien-mga akien-mga modified the milestones: 4.x, 4.2 Dec 1, 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.

is_connected returns false when it handler is registered
2 participants