Skip to content

Conversation

@oddbookworm
Copy link
Member

fixes a whole bunch o' segfaults related to surface, draw, and transform

@oddbookworm oddbookworm requested a review from a team as a code owner February 25, 2023 02:47
@oddbookworm
Copy link
Member Author

This is a reopening of pygame/pygame#3680 with additions from pygame/pygame#3525

@ankith26 ankith26 added this to the 2.1.4 milestone Feb 28, 2023
src_c/surface.c Outdated
Comment on lines 1823 to 1826
SDL_Surface *surf = pgSurface_AsSurface(self);
SURF_INIT_CHECK(surf)

SDL_Surface *src, *dest = pgSurface_AsSurface(self);
Copy link
Member

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
Comment on lines 1846 to 1844
if (!dest || !src)
return RAISE(pgExc_SDLError, "display Surface quit");
if (!dest) {
SURF_INIT_CHECK(src)
}
Copy link
Member

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
Comment on lines 1898 to 1901
SDL_Surface *surf = pgSurface_AsSurface(self);
SURF_INIT_CHECK(surf)

SDL_Surface *src, *dest = pgSurface_AsSurface(self);
Copy link
Member

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()

Copy link
Member

@MyreMylar MyreMylar left a 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. 🔨

@oddbookworm oddbookworm closed this Mar 3, 2023
@oddbookworm oddbookworm reopened this Mar 3, 2023
@oddbookworm oddbookworm requested a review from MyreMylar March 3, 2023 04:07
Copy link
Member

@MyreMylar MyreMylar left a comment

Choose a reason for hiding this comment

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

LGTM 👍

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, thanks for the PR 🥳

@ankith26 ankith26 merged commit 0cc57b6 into pygame-community:main Mar 4, 2023
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.

3 participants