mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-17 10:18:28 +00:00
SDL_test: destroy windows in SDL_CommonQuit
Not destroying the windows, caused a leak in checkkeys when exiting by clicking somewhere in the window: Allocation 0: 8 bytes 0x7f46f56d2fe8: SDL_realloc_REAL+0x3d 0x7f46f565deb7: GetMouseInputSource+0x88 0x7f46f565e07b: SDL_PrivateSendMouseButton+0x56 0x7f46f565e5aa: SDL_SendMouseButton+0x44 0x7f46f57fb0a4: pointer_handle_button_common+0x1bb 0x7f46f57fb0f3: pointer_handle_button+0x41 0x7f46f5123be6: ffi_prep_go_closure+0x2c6 0x7f46f51204bf: SDL_InitSubSystem+0x19 0x7f46f512318e: ffi_call+0x12e
This commit is contained in:
parent
98da2dd303
commit
248b1edd3f
1 changed files with 6 additions and 1 deletions
|
@ -2435,7 +2435,6 @@ void SDLTest_CommonQuit(SDLTest_CommonState *state)
|
|||
common_usage_audio = NULL;
|
||||
common_usage_videoaudio = NULL;
|
||||
|
||||
SDL_free(state->windows);
|
||||
if (state->targets) {
|
||||
for (i = 0; i < state->num_windows; ++i) {
|
||||
if (state->targets[i]) {
|
||||
|
@ -2452,6 +2451,12 @@ void SDLTest_CommonQuit(SDLTest_CommonState *state)
|
|||
}
|
||||
SDL_free(state->renderers);
|
||||
}
|
||||
if (state->windows) {
|
||||
for (i = 0; i < state->num_windows; i++) {
|
||||
SDL_DestroyWindow(state->windows[i]);
|
||||
}
|
||||
SDL_free(state->windows);
|
||||
}
|
||||
if (state->flags & SDL_INIT_VIDEO) {
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue