From 452c6831ccc97389845cc78515d0826266e1ea09 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 23 Dec 2004 06:10:53 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=4927 --- api/x_opengl.C | 23 +++++++++++++---------- checkin_notes | 7 +++++++ 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/api/x_opengl.C b/api/x_opengl.C index 9f03f2258e..5ee28f48e3 100644 --- a/api/x_opengl.C +++ b/api/x_opengl.C @@ -192,29 +192,32 @@ void restart() { void xwin_graphics_event_loop() { char* args[] = {"foobar", 0}; int one=1; - static bool first=true; + static bool glut_inited = false; graphics_thread = pthread_self(); + + atexit(restart); int restarted = setjmp(jbuf); -#ifdef __APPLE_CC__ - first = true; -#endif - if (first) { - glutInit(&one, args); - first = false; - } - if (restarted) { + if (!glut_inited) { + // here glutInit() must have failed and called exit(). + // returning will cause the graphics thread to exit. + return; + } //fprintf(stderr, "graphics thread restarted\n"); fflush(stderr); +#ifdef __APPLE_CC__ + glutInit(&one, args); +#endif set_mode(MODE_HIDE_GRAPHICS); } else { + glutInit(&one, args); + glut_inited = true; if (boinc_is_standalone()) { set_mode(MODE_WINDOW); } else { wait_for_initial_message(); timer_handler(0); - atexit(restart); } } glutTimerFunc(TIMER_INTERVAL_MSEC, timer_handler, 0); diff --git a/checkin_notes b/checkin_notes index 98b0029573..3f5279241b 100755 --- a/checkin_notes +++ b/checkin_notes @@ -21757,3 +21757,10 @@ Rom 22 Dec 2004 Rom 22 Dec 2004 (boinc) - Tag for 4.57 release, all platforms boinc_core_release_4_57 + +David 22 Dec 2004 + - shuffle logic in xwin_graphics_event_loop() to deal with + situation where glutInit() calls exit() + + api/ + x_opengl.C