Browse Source

fix crash on glx implementations that don't support FBConfig

rdb 14 years ago
parent
commit
e53e831142

+ 11 - 15
panda/src/glxdisplay/glxGraphicsStateGuardian.cxx

@@ -266,24 +266,20 @@ choose_pixel_format(const FrameBufferProperties &properties,
   if (!_supports_fbconfig) {
     // We have a good OpenGL context, but it doesn't support the
     // FBConfig interface, so we'll stop there.
-    if (glxdisplay_cat.is_debug()) {
-      glxdisplay_cat.debug()
-        <<" No FBConfig supported; using XVisual only.\n";
-
-      glxdisplay_cat.debug()
-        << _fbprops << "\n";
+    glxdisplay_cat.debug()
+      <<" No FBConfig supported; using XVisual only.\n"
+      << _fbprops << "\n";
 
-      _context = _temp_context;
-      _temp_context = (GLXContext)NULL;
+    _context = _temp_context;
+    _temp_context = (GLXContext)NULL;
 
-      // By convention, every indirect XVisual that can render to a
-      // window can also render to a GLXPixmap.  Direct visuals we're
-      // not as sure about.
-      _context_has_pixmap = !glXIsDirect(_display, _context);
+    // By convention, every indirect XVisual that can render to a
+    // window can also render to a GLXPixmap.  Direct visuals we're
+    // not as sure about.
+    _context_has_pixmap = !glXIsDirect(_display, _context);
 
-      // Pbuffers aren't supported at all with the XVisual interface.
-      _context_has_pbuffer = false;
-    }
+    // Pbuffers aren't supported at all with the XVisual interface.
+    _context_has_pbuffer = false;
     return;
   }
 

+ 7 - 0
panda/src/glxdisplay/glxGraphicsWindow.cxx

@@ -179,6 +179,13 @@ open_window() {
     }
   }
   
+  if (glxgsg->_context == NULL) {
+    // We're supposed to have a context at this point.
+    glxdisplay_cat.error()
+      << "No GLX context: cannot open window.\n";
+    return false;
+  }
+  
   _visual_info = glxgsg->_visual;
   if (_visual_info == NULL) {
     // No X visual for this fbconfig; how can we open the window?