From 9e90acdfcffea846755a9982f1d0f648faf8bdaa Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 18 Jan 2014 11:47:03 -0800 Subject: [PATCH] Make sure you clean up the associated renderer when destroying a window. --- src/test/SDL_test_common.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c index 38b093a43..f07a0c0cb 100644 --- a/src/test/SDL_test_common.c +++ b/src/test/SDL_test_common.c @@ -1281,9 +1281,17 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done) { SDL_Window *window = SDL_GetWindowFromID(event->window.windowID); if (window) { - SDL_DestroyWindow(window); for (i = 0; i < state->num_windows; ++i) { if (window == state->windows[i]) { + if (state->targets[i]) { + SDL_DestroyTexture(state->targets[i]); + state->targets[i] = NULL; + } + if (state->renderers[i]) { + SDL_DestroyRenderer(state->renderers[i]); + state->renderers[i] = NULL; + } + SDL_DestroyWindow(state->windows[i]); state->windows[i] = NULL; break; }