From 6ffea5d693b5925df641d656d7da2f8dd43cde51 Mon Sep 17 00:00:00 2001 From: David Rose Date: Tue, 18 Mar 2003 02:05:33 +0000 Subject: [PATCH] close window if gsg fails --- panda/src/display/graphicsWindow.cxx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/panda/src/display/graphicsWindow.cxx b/panda/src/display/graphicsWindow.cxx index 941e610b61..16399938e1 100644 --- a/panda/src/display/graphicsWindow.cxx +++ b/panda/src/display/graphicsWindow.cxx @@ -588,7 +588,18 @@ begin_frame() { } make_gsg(); if (_gsg == (GraphicsStateGuardian *)NULL) { - // Still couldn't make the GSG for some reason. + // Still couldn't make the GSG for some reason. We should pass + // an appropriate diagnostic up to the application; for now, + // we'll just shut down the window. + + // WARNING: this is a non-thread-safe hack. This really should + // happen in the window thread, not here in the draw thread. + display_cat.info() + << "Could not open GSG, closing " << get_type() << ".\n"; + close_window(); + WindowProperties properties; + properties.set_open(false); + system_changed_properties(properties); return false; } } else {