Skip to content

Commit

Permalink
[SDL backend] Clear pointer to SDL_Window when window is closed
Browse files Browse the repository at this point in the history
  • Loading branch information
past-due committed Dec 23, 2019
1 parent 2edb62e commit bfe558d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/sdl/main_sdl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2082,6 +2082,7 @@ static void handleActiveEvent(SDL_Event *event)
break;
case SDL_WINDOWEVENT_CLOSE:
debug(LOG_WZ, "Window %d closed", event->window.windowID);
WZwindow = nullptr;
break;
default:
debug(LOG_WZ, "Window %d got unknown event %d", event->window.windowID, event->window.event);
Expand Down Expand Up @@ -2168,7 +2169,11 @@ void wzShutdown()
{
// order is important!
sdlFreeCursors();
SDL_DestroyWindow(WZwindow);
if (WZwindow != nullptr)
{
SDL_DestroyWindow(WZwindow);
WZwindow = nullptr;
}
SDL_Quit();
appPtr->quit();
delete appPtr;
Expand Down

0 comments on commit bfe558d

Please sign in to comment.