From 494dddce12f9913e9c7341f0c86e45aa607f618e Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sun, 6 Apr 2003 00:33:35 +0000 Subject: [PATCH] Remove extra atexit() call. Defer SDL_VIDEO_INIT as long as possible; remove extra call. Make sure seticon() doesn't bomb if we havn't yet initialized video. --- stepmania/src/StepMania.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index 0a90e0dd81..f4af135da6 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -162,7 +162,8 @@ static void SetIcon() zoomSurface(srf, 32, 32); SDL_SetAlpha( srf, SDL_SRCALPHA, SDL_ALPHA_OPAQUE ); - SDL_WM_SetIcon(srf, NULL /* derive from alpha */); + if(SDL_WasInit(SDL_INIT_VIDEO)) + SDL_WM_SetIcon(srf, NULL /* derive from alpha */); SDL_FreeSurface(srf); } @@ -248,23 +249,20 @@ int main(int argc, char* argv[]) #endif SDL_Init(SDL_flags); - atexit(SDL_Quit); - CString g_sErrorString = ""; #ifndef DEBUG try{ #endif - /* Initialize the SDL library. */ - if( SDL_InitSubSystem(SDL_INIT_VIDEO) < 0 ) - RageException::Throw( "Couldn't initialize SDL: %s", SDL_GetError() ); - - SetIcon(); LoadingWindow *loading_window = MakeLoadingWindow(); - /* This might be using SDL, so reset the caption. */ + + /* We might be using SDL, so set generic window properties (icon and caption). + * Be careful; we might not have an SDL window at all. */ SDL_WM_SetCaption("StepMania", "StepMania"); + SetIcon(); + loading_window->Paint(); // changed to use time. GetTimeSinceStart is silly because it always return 0! -Chris