Fixed bug 2344 - CHECK_WINDOW_MAGIC should include __FILE__ and __LINE__

Martin Gerhardy

just for easier debugging issues in the own code...

SDL_CreateRenderer should maybe also use this macro

Ryan C. Gordon

I'll go one better: it should have an SDL_assert().
This commit is contained in:
Sam Lantinga 2017-08-14 16:34:54 -07:00
parent 96e15fa7f6
commit aebe17d34f
2 changed files with 4 additions and 0 deletions

View file

@ -33,12 +33,14 @@
#define SDL_WINDOWRENDERDATA "_SDL_WindowRenderData"
#define CHECK_RENDERER_MAGIC(renderer, retval) \
SDL_assert(renderer && renderer->magic == &renderer_magic); \
if (!renderer || renderer->magic != &renderer_magic) { \
SDL_SetError("Invalid renderer"); \
return retval; \
}
#define CHECK_TEXTURE_MAGIC(texture, retval) \
SDL_assert(texture && texture->magic == &texture_magic); \
if (!texture || texture->magic != &texture_magic) { \
SDL_SetError("Invalid texture"); \
return retval; \