Skip to content

Commit

Permalink
video: NULL out pointer to freed window surface
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jayschwa committed Apr 12, 2020
1 parent abcc670 commit 8a5ee3f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/video/SDL_video.c
Expand Up @@ -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);
Expand Down

0 comments on commit 8a5ee3f

Please sign in to comment.