More to fix a deinitialization related crash.

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@180 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
cjp 2003-09-09 17:50:31 +00:00
parent 1358592415
commit fdd998e66a

View File

@ -399,67 +399,6 @@ void fgWarning( const char *fmt, ... )
va_end( ap ); va_end( ap );
} }
/*
* Clean up on exit
*/
static void fgCleanUpGlutsMess( void )
{
int i;
i = 0;
if ( fgStructure.Windows.First != NULL )
{
SFG_Window *win = (SFG_Window *)fgStructure.Windows.First ;
glEnd();
glFinish();
glFlush();
while ( win != NULL )
{
SFG_Window *temp_win = (SFG_Window *)win->Node.Next ;
fgDestroyWindow ( win, FALSE ) ;
win = temp_win ;
}
}
#if 0
/* these are pointers to external handles */
__glutWindowListSize = 0;
__glutStaleWindowList = NULL;
__glutWindowList = NULL;
__glutCurrentWindow = NULL;
/* make sure we no longer have a GL context */
if ( wglGetCurrentContext() != NULL )
{
wglDeleteContext( wglGetCurrentContext() );
}
hInstance = GetModuleHandle(NULL);
UnregisterClass( classname, hInstance );
/* clean up allocated timer memory */
tList = __glutTimerList;
i = 0;
while ( __glutTimerList )
{
i++;
tList = __glutTimerList;
if ( __glutTimerList )
__glutTimerList = __glutTimerList->next;
if ( tList )
free( tList );
}
#endif
}
/* -- INTERFACE FUNCTIONS -------------------------------------------------- */ /* -- INTERFACE FUNCTIONS -------------------------------------------------- */
/* /*
@ -1180,23 +1119,21 @@ void FGAPIENTRY glutMainLoop( void )
fgState.ExecState = GLUT_EXEC_STATE_STOP ; fgState.ExecState = GLUT_EXEC_STATE_STOP ;
} }
{
fgExecutionState execState = fgState.ActionOnWindowClose;
/* /*
* If we got here by the user closing a window or by the application closing down, there may still be windows open. * When this loop terminates, destroy the display, state and structure
*/ * of a freeglut session, so that another glutInit() call can happen
fgCleanUpGlutsMess () ; */
fgDeinitialize();
/* /*
* Check whether we return to the calling program or simply exit * Check whether we return to the calling program or simply exit
*/ */
if ( fgState.ActionOnWindowClose == GLUT_ACTION_EXIT ) if ( execState == GLUT_ACTION_EXIT )
exit ( 0 ) ; exit ( 0 ) ;
}
/*
* When this loop terminates, destroy the display, state and structure
* of a freeglut session, so that another glutInit() call can happen
*/
fgDeinitialize();
} }
/* /*