Skip to content

Commit

Permalink
Fixed crash at shutdown if the window couldn't be created
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Aug 28, 2017
1 parent 071e101 commit ded5b3a
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/test/SDL_test_common.c
Expand Up @@ -822,13 +822,13 @@ SDLTest_CommonInit(SDLTest_CommonState * state)
fullscreen_mode.refresh_rate = state->refresh_rate;

state->windows =
(SDL_Window **) SDL_malloc(state->num_windows *
(SDL_Window **) SDL_calloc(state->num_windows,
sizeof(*state->windows));
state->renderers =
(SDL_Renderer **) SDL_malloc(state->num_windows *
(SDL_Renderer **) SDL_calloc(state->num_windows,
sizeof(*state->renderers));
state->targets =
(SDL_Texture **) SDL_malloc(state->num_windows *
(SDL_Texture **) SDL_calloc(state->num_windows,
sizeof(*state->targets));
if (!state->windows || !state->renderers) {
SDL_Log("Out of memory!\n");
Expand Down Expand Up @@ -881,9 +881,6 @@ SDLTest_CommonInit(SDLTest_CommonState * state)

SDL_ShowWindow(state->windows[i]);

state->renderers[i] = NULL;
state->targets[i] = NULL;

if (!state->skip_renderer
&& (state->renderdriver
|| !(state->window_flags & (SDL_WINDOW_OPENGL | SDL_WINDOW_VULKAN)))) {
Expand Down

0 comments on commit ded5b3a

Please sign in to comment.