Pārlūkot izejas kodu

video: NULL out pointer to freed window surface

This behavior matches SDL_RecreateWindow and makes it less likely that
another piece of code (e.g. a DestroyWindowFramebuffer implementation)
will attempt to use or free the stale surface pointer.
Jay Petacat 5 gadi atpakaļ
vecāks
revīzija
8a5ee3faf9
1 mainītis faili ar 2 papildinājumiem un 0 dzēšanām
  1. 2 0
      src/video/SDL_video.c

+ 2 - 0
src/video/SDL_video.c

@@ -2796,6 +2796,8 @@ SDL_DestroyWindow(SDL_Window * window)
     if (window->surface) {
         window->surface->flags &= ~SDL_DONTFREE;
         SDL_FreeSurface(window->surface);
+        window->surface = NULL;
+        window->surface_valid = SDL_FALSE;
     }
     if (_this->DestroyWindowFramebuffer) {
         _this->DestroyWindowFramebuffer(_this, window);