소스 검색

Fixed double-free when using window surfaces

Sam Lantinga 11 시간 전
부모
커밋
0eff3fe558
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      src/video/SDL_video.c

+ 2 - 2
src/video/SDL_video.c

@@ -4429,6 +4429,8 @@ void SDL_DestroyWindow(SDL_Window *window)
 
     SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_DESTROYED, 0, 0);
 
+    SDL_DestroyWindowSurface(window);
+
     SDL_Renderer *renderer = SDL_GetRenderer(window);
     if (renderer) {
         SDL_DestroyRendererWithoutFreeing(renderer);
@@ -4469,8 +4471,6 @@ void SDL_DestroyWindow(SDL_Window *window)
         SDL_SetMouseFocus(NULL);
     }
 
-    SDL_DestroyWindowSurface(window);
-
     // Make no context current if this is the current context window
     if (window->flags & SDL_WINDOW_OPENGL) {
         if (_this->current_glwin == window) {