[Plib-cvs] plib/src/pui pu.cxx,1.63,1.64 pu.h,1.136,1.137 puGroup.cxx,1.23,1.24 puInterface.cxx,1.17
Brought to you by:
sjbaker
From: Norman V. <nh...@us...> - 2003-02-07 15:02:54
|
Update of /cvsroot/plib/plib/src/pui In directory sc8-pr-cvs1:/tmp/cvs-serv26704 Modified Files: pu.cxx pu.h puGroup.cxx puInterface.cxx Log Message: changes from John Fay allowing PUI to shut down gracefully Index: pu.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/pu.cxx,v retrieving revision 1.63 retrieving revision 1.64 diff -u -d -r1.63 -r1.64 --- pu.cxx 1 Dec 2002 18:21:47 -0000 1.63 +++ pu.cxx 7 Feb 2003 15:02:49 -0000 1.64 @@ -207,7 +207,7 @@ } -static void puCleanUpJunk ( void ) +void puCleanUpJunk ( void ) { puObject * local_objects_to_delete = objects_to_delete ; objects_to_delete = NULL ; @@ -215,8 +215,17 @@ while ( local_objects_to_delete != NULL ) { puObject *next_ob = local_objects_to_delete -> getNextObject() ; - delete local_objects_to_delete ; + delete local_objects_to_delete ; local_objects_to_delete = next_ob ; + + /* If we've reached the end of the list, start over (in case we've deleted a group and + * it has put new widgets on the delete list) + */ + if ( local_objects_to_delete == NULL ) + { + local_objects_to_delete = objects_to_delete ; + objects_to_delete = NULL ; + } } } @@ -224,10 +233,10 @@ static puObject *active_widget ; /* Widget which is currently receiving user input */ static char *input_paste_buffer ; /* Cut/Copy/Paste buffer for input widgets */ +static int firsttime = TRUE ; + void puInit ( void ) { - static int firsttime = TRUE ; - if ( firsttime ) { if ( ! glIsValidContext () ) @@ -256,6 +265,15 @@ #endif } +} + +void puExit ( void ) +{ + if ( firsttime ) + ulSetError ( UL_FATAL, "puExit called without a previous call to puInit." ) ; + + delete puGetBaseLiveInterface () ; + firsttime = TRUE ; } static void puSetOpenGLState ( void ) Index: pu.h =================================================================== RCS file: /cvsroot/plib/plib/src/pui/pu.h,v retrieving revision 1.136 retrieving revision 1.137 diff -u -d -r1.136 -r1.137 --- pu.h 27 Sep 2002 23:53:52 -0000 1.136 +++ pu.h 7 Feb 2003 15:02:49 -0000 1.137 @@ -344,8 +344,9 @@ void puInit ( void ) ; +void puExit ( void ) ; void puDisplay ( void ) ; -void puDisplay ( int window_number ) ; +void puDisplay ( int window_number ) ; /* Deprecated */ int puMouse ( int button, int updown, int x, int y ) ; int puMouse ( int x, int y ) ; int puKeyboard ( int key, int updown ) ; Index: puGroup.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puGroup.cxx,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- puGroup.cxx 2 Sep 2002 06:05:45 -0000 1.23 +++ puGroup.cxx 7 Feb 2003 15:02:50 -0000 1.24 @@ -348,6 +348,8 @@ puGroup::~puGroup () { + void puCleanUpJunk ( void ) ; + puObject *bo = getLastChild () ; while ( bo != NULL ) @@ -356,6 +358,9 @@ bo = bo -> getPrevObject() ; puDeleteObject ( dlist ) ; } + + // Since this is an object destructor, it should be okay to delete the child objects as well. + puCleanUpJunk () ; } Index: puInterface.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puInterface.cxx,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- puInterface.cxx 2 Sep 2002 06:05:45 -0000 1.17 +++ puInterface.cxx 7 Feb 2003 15:02:50 -0000 1.18 @@ -106,6 +106,8 @@ puInterface::~puInterface () { + void puCleanUpJunk ( void ) ; + puObject *bo = getLastChild () ; while ( bo != NULL ) @@ -114,6 +116,9 @@ bo = bo -> getPrevObject() ; puDeleteObject ( dlist ) ; } + + // Since this is an object destructor, it should be okay to delete the child objects as well. + puCleanUpJunk () ; dlist = NULL ; |