Added Nigel's suggested code to clear all but the destroy callback early
on, leaving Destroy to be cleared later after the last possible point where it should be invoked. git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@329 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
parent
6230b2de2a
commit
f02f918842
@ -204,6 +204,21 @@ void fgAddToWindowDestroyList ( SFG_Window* window, GLboolean needToClose )
|
|||||||
if( fgStructure.Window == window )
|
if( fgStructure.Window == window )
|
||||||
fgStructure.Window = NULL;
|
fgStructure.Window = NULL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Clear all window callbacks except Destroy, which will
|
||||||
|
* be invoked later. Right now, we are potentially carrying
|
||||||
|
* out a freeglut operation at the behest of a client callback,
|
||||||
|
* so we are reluctant to re-enter the client with the Destroy
|
||||||
|
* callback, right now. The others are all wiped out, however,
|
||||||
|
* to ensure that they are no longer called after this point.
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
void *destroy = FETCH_WCB( *window, Destroy );
|
||||||
|
fgClearCallBacks( window );
|
||||||
|
FETCH_WCB( *window, Destroy ) = destroy;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the destroyed window has the highest window ID number, decrement
|
* If the destroyed window has the highest window ID number, decrement
|
||||||
* the window ID number.
|
* the window ID number.
|
||||||
@ -226,14 +241,12 @@ void fgAddToWindowDestroyList ( SFG_Window* window, GLboolean needToClose )
|
|||||||
* "ExecState" after this function returns.
|
* "ExecState" after this function returns.
|
||||||
*/
|
*/
|
||||||
if( fgState.ActionOnWindowClose != GLUT_ACTION_CONTINUE_EXECUTION )
|
if( fgState.ActionOnWindowClose != GLUT_ACTION_CONTINUE_EXECUTION )
|
||||||
{
|
|
||||||
/*
|
/*
|
||||||
* Set the execution state flag to drop out of the main loop.
|
* Set the execution state flag to drop out of the main loop.
|
||||||
*/
|
*/
|
||||||
if( fgState.ActionOnWindowClose == GLUT_ACTION_EXIT )
|
if( fgState.ActionOnWindowClose == GLUT_ACTION_EXIT )
|
||||||
fgState.ExecState = GLUT_EXEC_STATE_STOP;
|
fgState.ExecState = GLUT_EXEC_STATE_STOP;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Function to close down all the windows in the "WindowsToDestroy" list
|
* Function to close down all the windows in the "WindowsToDestroy" list
|
||||||
@ -285,6 +298,7 @@ void fgDestroyWindow( SFG_Window* window, GLboolean needToClose )
|
|||||||
SFG_Window *activeWindow = fgStructure.Window ;
|
SFG_Window *activeWindow = fgStructure.Window ;
|
||||||
INVOKE_WCB( *window, Destroy, ( ) );
|
INVOKE_WCB( *window, Destroy, ( ) );
|
||||||
fgSetWindow ( activeWindow ) ;
|
fgSetWindow ( activeWindow ) ;
|
||||||
|
fgClearCallBacks( window );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( window->Parent != NULL )
|
if ( window->Parent != NULL )
|
||||||
|
Reference in New Issue
Block a user