Skip to content

More faithfully track SDL_GetColorKey semantics - #623

Merged
slouken merged 1 commit into
libsdl-org:mainfrom
michaelcmartin:colorkey
Aug 22, 2026
Merged

slouken merged 1 commit into
libsdl-org:mainfrom
michaelcmartin:colorkey

Conversation

@michaelcmartin

Copy link
Copy Markdown
Contributor

SDL3_GetSurfaceColorKey starts by writing 0 to *key if non-NULL. (see: https://github.com/libsdl-org/SDL/blob/main/src/video/SDL_surface.c#L703)

SDL_GetColorKey only does so if the call will ultimately succeed. (see: https://github.com/libsdl-org/SDL/blob/release-2.32.x/src/video/SDL_surface.c#L392)

This patch updates the sdl2-compat implementation to leaves the value of *key untouched on failure paths. This fixes issue #621 in UQM 0.8 where the flashrect does not function properly.

SDL3_GetSurfaceColorKey starts by writing 0 to *key if non-NULL.
SDL_GetColorKey only does so if the call will ultimately succeed.

This patch leaves the value of *key untouched on failure paths.
@slouken
slouken merged commit 915f1b4 into libsdl-org:main Aug 22, 2026
8 checks passed
@slouken

slouken commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

Merged, thanks!

@slouken slouken added this to the 2.32.72 milestone Sep 2, 2026
@michaelcmartin
michaelcmartin deleted the colorkey branch September 20, 2026 05:52
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.

2 participants