X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Ffreeglut_structure.c;h=8a19affafb7e0f3573c5ef90910e5b7dd1844b12;hb=df33277ecd0e20914a9cb3aa5bfc17e0023b3334;hp=21b6cfb976637df472a657982fdd8fc5cd5b8b40;hpb=9092fad9f750e8bab3ce7d7fc5a30f2b036a1cfb;p=freeglut diff --git a/src/freeglut_structure.c b/src/freeglut_structure.c index 21b6cfb..8a19aff 100644 --- a/src/freeglut_structure.c +++ b/src/freeglut_structure.c @@ -54,9 +54,12 @@ SFG_Structure fgStructure = { { NULL, NULL }, /* The list of windows */ void fgClearCallBacks( SFG_Window *window ) { - int i; - for( i = 0; i < TOTAL_CALLBACKS; ++i ) - window->CallBacks[ i ] = NULL; + if( window ) + { + int i; + for( i = 0; i < TOTAL_CALLBACKS; ++i ) + window->CallBacks[ i ] = NULL; + } } /* @@ -80,7 +83,7 @@ SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title, * If the freeglut internals haven't been initialized yet, * do it now. Hack's idea courtesy of Chris Purnell... */ - if( !fgState.Time.Set ) + if( !fgState.Initalized ) glutInit( &fakeArgc, NULL ); /* @@ -133,7 +136,7 @@ SFG_Menu* fgCreateMenu( FGCBMenu menuCallback ) * If the freeglut internals haven't been initialized yet, * do it now. Hack's idea courtesy of Chris Purnell... */ - if( !fgState.Time.Set ) + if( !fgState.Initalized ) glutInit( &fakeArgc, NULL ); menu->ParentWindow = fgStructure.Window; @@ -314,12 +317,12 @@ void fgDestroyWindow( SFG_Window* window, GLboolean needToClose ) window->Menu[menu_index]->ParentWindow = NULL ; } + fgClearCallBacks( window ); if( needToClose == TRUE ) fgCloseWindow( window ); free( window ); if( fgStructure.Window == window ) fgStructure.Window = NULL; - fgClearCallBacks( window ); } /*