소스 검색

Merge pull request #1959 from Areloch/SDLSplashScreenCleanupSanity

Does better sanity checking on cleanup for the splash screen closing in SDL
Areloch 8 년 전
부모
커밋
840d53c283
1개의 변경된 파일20개의 추가작업 그리고 4개의 파일을 삭제
  1. 20 4
      Engine/source/windowManager/sdl/sdlSplashScreen.cpp

+ 20 - 4
Engine/source/windowManager/sdl/sdlSplashScreen.cpp

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