Skip to content

Commit

Permalink
Make sure you clean up the associated renderer when destroying a window.
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jan 18, 2014
1 parent 129640a commit 9e90acd
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/test/SDL_test_common.c
Expand Up @@ -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;
}
Expand Down

0 comments on commit 9e90acd

Please sign in to comment.