Does better sanity checking on cleanup for the splash screen closing with SDL. Could erroneously get called a second time and if we'd already cleared the images and textures, it could crash.

This fixes that.
This commit is contained in:
Areloch 2017-03-02 00:02:28 -06:00
parent 5c8a82180b
commit c91c900e19

View file

@ -102,11 +102,27 @@ bool Platform::displaySplashWindow( String path )
} }
bool Platform::closeSplashWindow() bool Platform::closeSplashWindow()
{
if (gSplashTexture != nullptr)
{ {
SDL_DestroyTexture(gSplashTexture); SDL_DestroyTexture(gSplashTexture);
gSplashTexture = nullptr;
}
if (gSplashImage != nullptr)
{
SDL_FreeSurface(gSplashImage); SDL_FreeSurface(gSplashImage);
gSplashImage = nullptr;
}
if (gSplashRenderer != nullptr)
{
SDL_DestroyRenderer(gSplashRenderer); SDL_DestroyRenderer(gSplashRenderer);
gSplashRenderer = nullptr;
}
if (gSplashWindow != nullptr)
{
SDL_DestroyWindow(gSplashWindow); SDL_DestroyWindow(gSplashWindow);
gSplashWindow = nullptr;
}
return true; return true;
} }