mirror of https://github.com/encounter/SDL.git
Fixed crash at shutdown if the window couldn't be created
This commit is contained in:
parent
071e101837
commit
ded5b3a4b4
|
@ -822,13 +822,13 @@ SDLTest_CommonInit(SDLTest_CommonState * state)
|
||||||
fullscreen_mode.refresh_rate = state->refresh_rate;
|
fullscreen_mode.refresh_rate = state->refresh_rate;
|
||||||
|
|
||||||
state->windows =
|
state->windows =
|
||||||
(SDL_Window **) SDL_malloc(state->num_windows *
|
(SDL_Window **) SDL_calloc(state->num_windows,
|
||||||
sizeof(*state->windows));
|
sizeof(*state->windows));
|
||||||
state->renderers =
|
state->renderers =
|
||||||
(SDL_Renderer **) SDL_malloc(state->num_windows *
|
(SDL_Renderer **) SDL_calloc(state->num_windows,
|
||||||
sizeof(*state->renderers));
|
sizeof(*state->renderers));
|
||||||
state->targets =
|
state->targets =
|
||||||
(SDL_Texture **) SDL_malloc(state->num_windows *
|
(SDL_Texture **) SDL_calloc(state->num_windows,
|
||||||
sizeof(*state->targets));
|
sizeof(*state->targets));
|
||||||
if (!state->windows || !state->renderers) {
|
if (!state->windows || !state->renderers) {
|
||||||
SDL_Log("Out of memory!\n");
|
SDL_Log("Out of memory!\n");
|
||||||
|
@ -881,9 +881,6 @@ SDLTest_CommonInit(SDLTest_CommonState * state)
|
||||||
|
|
||||||
SDL_ShowWindow(state->windows[i]);
|
SDL_ShowWindow(state->windows[i]);
|
||||||
|
|
||||||
state->renderers[i] = NULL;
|
|
||||||
state->targets[i] = NULL;
|
|
||||||
|
|
||||||
if (!state->skip_renderer
|
if (!state->skip_renderer
|
||||||
&& (state->renderdriver
|
&& (state->renderdriver
|
||||||
|| !(state->window_flags & (SDL_WINDOW_OPENGL | SDL_WINDOW_VULKAN)))) {
|
|| !(state->window_flags & (SDL_WINDOW_OPENGL | SDL_WINDOW_VULKAN)))) {
|
||||||
|
|
Loading…
Reference in New Issue