Make sure you clean up the associated renderer when destroying a window.
authorSam Lantinga <slouken@libsdl.org>
Sat, 18 Jan 2014 11:47:03 -0800
changeset 8115fa3f46850b5e
parent 8114 919edd1b6bd0
child 8116 f7c2f71251e5
Make sure you clean up the associated renderer when destroying a window.
src/test/SDL_test_common.c
     1.1 --- a/src/test/SDL_test_common.c	Thu Jan 16 15:02:41 2014 -0300
     1.2 +++ b/src/test/SDL_test_common.c	Sat Jan 18 11:47:03 2014 -0800
     1.3 @@ -1281,9 +1281,17 @@
     1.4              {
     1.5                  SDL_Window *window = SDL_GetWindowFromID(event->window.windowID);
     1.6                  if (window) {
     1.7 -                    SDL_DestroyWindow(window);
     1.8                      for (i = 0; i < state->num_windows; ++i) {
     1.9                          if (window == state->windows[i]) {
    1.10 +                            if (state->targets[i]) {
    1.11 +                                SDL_DestroyTexture(state->targets[i]);
    1.12 +                                state->targets[i] = NULL;
    1.13 +                            }
    1.14 +                            if (state->renderers[i]) {
    1.15 +                                SDL_DestroyRenderer(state->renderers[i]);
    1.16 +                                state->renderers[i] = NULL;
    1.17 +                            }
    1.18 +                            SDL_DestroyWindow(state->windows[i]);
    1.19                              state->windows[i] = NULL;
    1.20                              break;
    1.21                          }