[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33407] trunk/blender/intern/ghost/intern/ GHOST_WindowX11.cpp: quit blender if the first X11 window fails to open.

Campbell Barton ideasman42 at gmail.com
Wed Dec 1 08:15:07 CET 2010


Revision: 33407
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33407
Author:   campbellbarton
Date:     2010-12-01 08:15:05 +0100 (Wed, 01 Dec 2010)

Log Message:
-----------
quit blender if the first X11 window fails to open.
mainly just to avoid a segfault so the user knows its not a bug.

Modified Paths:
--------------
    trunk/blender/intern/ghost/intern/GHOST_WindowX11.cpp

Modified: trunk/blender/intern/ghost/intern/GHOST_WindowX11.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_WindowX11.cpp	2010-12-01 05:59:11 UTC (rev 33406)
+++ trunk/blender/intern/ghost/intern/GHOST_WindowX11.cpp	2010-12-01 07:15:05 UTC (rev 33407)
@@ -176,10 +176,21 @@
 	int attributes[40], i, samples;
 	Atom atoms[2];
 	int natom;
-	int glxVersionMajor, glxVersionMinor; // As in GLX major.minor
+	int glxVersionMajor, glxVersionMinor; // As in GLX major.mino
+	
+	/* initialize incase X11 fails to load */
+	memset(&m_xtablet, 0, sizeof(m_xtablet));
+	m_visual= NULL;
 
 	if (!glXQueryVersion(m_display, &glxVersionMajor, &glxVersionMinor)) {
 		printf("%s:%d: X11 glXQueryVersion() failed, verify working openGL system!\n", __FILE__, __LINE__);
+		
+		/* exit if this is the first window */
+		if(s_firstContext==NULL) {
+			printf("initial window could not find the GLX extension, exit!\n");
+			exit(1);
+		}
+
 		return;
 	}
 
@@ -211,6 +222,12 @@
 			if (samples == 0) {
 				/* All options exhausted, cannot continue */
 				printf("%s:%d: X11 glXChooseVisual() failed, verify working openGL system!\n", __FILE__, __LINE__);
+				
+				if(s_firstContext==NULL) {
+					printf("initial window could not find the GLX extension, exit!\n");
+					exit(1);
+				}
+				
 				return;
 			}
 		} else {
@@ -221,8 +238,6 @@
 		}
 	}
 
-	memset(&m_xtablet, 0, sizeof(m_xtablet));
-
 	// Create a bunch of attributes needed to create an X window.
 
 





More information about the Bf-blender-cvs mailing list