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

Remove unnecessary lock in gfxdraw #3280

Merged
merged 1 commit into from
Jan 5, 2025

Conversation

Starbuck5
Copy link
Member

All the surrounding code is written to assume the surface has already been locked (which it has). Possibly this was a copy paste error many years ago, it's been in pygame/pygame-ce for at least 9 years.

If you look at the source of pixelColor vs pixelColorNolock, they do the exact same thing, except the former locks and unlocks the surface, which is unnecessary.

I noticed this when looking into porting gfxdraw to SDL3.

All the surrounding code is written to assume the surface has already been locked (which it has). Possibly this was a copy paste error many years ago, it's been in pygame/pygame-ce for at least 9 years.
@Starbuck5 Starbuck5 added the gfxdraw pygame.gfxdraw label Jan 5, 2025
@Starbuck5 Starbuck5 requested a review from a team as a code owner January 5, 2025 06:45
Copy link
Member

@damusss damusss left a comment

Choose a reason for hiding this comment

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

Damn, how did you spot this

Copy link
Member

@ankith26 ankith26 left a comment

Choose a reason for hiding this comment

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

LGTM, nice catch! 🎉

@ankith26 ankith26 added this to the 2.5.3 milestone Jan 5, 2025
@ankith26 ankith26 merged commit e5e2e5f into pygame-community:main Jan 5, 2025
25 checks passed
@Starbuck5 Starbuck5 deleted the tiny-gfxdraw-adjustment branch January 5, 2025 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gfxdraw pygame.gfxdraw
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants