From b0edf45d47b21aa28951728fbcbff0d41697ab80 Mon Sep 17 00:00:00 2001 From: Luke Ceddia Date: Thu, 21 Jan 2016 00:37:27 +1100 Subject: [PATCH] Fix _EXIT race condition that prevents exit; make _EXIT work on Linux. --- internal/c/libqb.cpp | 2 +- internal/c/parts/core/src/freeglut_main.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/c/libqb.cpp b/internal/c/libqb.cpp index 2470fc0b3..a4f4418e5 100644 --- a/internal/c/libqb.cpp +++ b/internal/c/libqb.cpp @@ -23845,7 +23845,7 @@ int32 func__exit(){ exit_blocked=1; static int32 x; x=exit_value; - exit_value=0; + if (x) exit_value = 0; return x; } diff --git a/internal/c/parts/core/src/freeglut_main.c b/internal/c/parts/core/src/freeglut_main.c index c64f03dfa..67903a863 100644 --- a/internal/c/parts/core/src/freeglut_main.c +++ b/internal/c/parts/core/src/freeglut_main.c @@ -1323,8 +1323,8 @@ void FGAPIENTRY glutMainLoopEvent( void ) if( (Atom) event.xclient.data.l[ 0 ] == fgDisplay.DeleteWindow ) { GETWINDOW( xclient ); - - fgDestroyWindow ( window ); + qb64_custom_event(QB64_EVENT_CLOSE,0,0,0,0,0,0,0,0,NULL,NULL); + /* fgDestroyWindow ( window ); if( fgState.ActionOnWindowClose == GLUT_ACTION_EXIT ) { @@ -1333,8 +1333,8 @@ void FGAPIENTRY glutMainLoopEvent( void ) } else if( fgState.ActionOnWindowClose == GLUT_ACTION_GLUTMAINLOOP_RETURNS ) fgState.ExecState = GLUT_EXEC_STATE_STOP; - return; + */ } break;