-
-
Notifications
You must be signed in to change notification settings - Fork 216
Surface, Draw, and Transform segfault fixes #1940
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
Conversation
|
This is a reopening of pygame/pygame#3680 with additions from pygame/pygame#3525 |
src_c/surface.c
Outdated
| SDL_Surface *surf = pgSurface_AsSurface(self); | ||
| SURF_INIT_CHECK(surf) | ||
|
|
||
| SDL_Surface *src, *dest = pgSurface_AsSurface(self); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we getting self as an SDL_Surface twice here? Think we could just add the check on src or dest after the existing call to pgSurface_AsSurface() (since they are pointing to the same thing here).
src_c/surface.c
Outdated
| if (!dest || !src) | ||
| return RAISE(pgExc_SDLError, "display Surface quit"); | ||
| if (!dest) { | ||
| SURF_INIT_CHECK(src) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this check is different now. Previously it would error if either src or dest were null, now it will only error if both src and dest are null.
src_c/surface.c
Outdated
| SDL_Surface *surf = pgSurface_AsSurface(self); | ||
| SURF_INIT_CHECK(surf) | ||
|
|
||
| SDL_Surface *src, *dest = pgSurface_AsSurface(self); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar issue as above. The check here could just be moved below the existing call to pgSurface_AsSurface()
MyreMylar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good 👍
Just a couple of spots that should be fixed. 🔨
MyreMylar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
ankith26
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for the PR 🥳
fixes a whole bunch o' segfaults related to surface, draw, and transform