[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55665] trunk/blender/source/blender/ editors/interface/interface_draw.c: fix/workaround [#34346] Blender total crashes when File/ User preferences twice and go to System tab

Campbell Barton ideasman42 at gmail.com
Fri Mar 29 08:14:19 CET 2013


Revision: 55665
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55665
Author:   campbellbarton
Date:     2013-03-29 07:14:18 +0000 (Fri, 29 Mar 2013)
Log Message:
-----------
fix/workaround [#34346] Blender total crashes when File/User preferences twice and go to System tab

Modified Paths:
--------------
    trunk/blender/source/blender/editors/interface/interface_draw.c

Modified: trunk/blender/source/blender/editors/interface/interface_draw.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_draw.c	2013-03-29 06:25:22 UTC (rev 55664)
+++ trunk/blender/source/blender/editors/interface/interface_draw.c	2013-03-29 07:14:18 UTC (rev 55665)
@@ -61,6 +61,15 @@
 /* own include */
 #include "interface_intern.h"
 
+/* only for bug workaround [#34346] */
+#if !defined(WIN32) && !defined(__APPLE__)
+#  define GPU_OSS_BUG_WOKAROUND
+#endif
+
+#ifdef GPU_OSS_BUG_WOKAROUND
+#  include "GPU_extensions.h"
+#endif
+
 static int roundboxtype = UI_CNR_ALL;
 
 void uiSetRoundBox(int type)
@@ -1236,6 +1245,7 @@
 
 void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, rcti *rect)
 {
+	static int use_displist = -1;
 	static GLuint displist = 0;
 	int a, old[8];
 	GLfloat diff[4], diffn[4] = {1.0f, 1.0f, 1.0f, 1.0f};
@@ -1285,20 +1295,30 @@
 	
 	glScalef(size, size, size);
 	
-	if (displist == 0) {
-		GLUquadricObj   *qobj;
+#ifdef GPU_OSS_BUG_WOKAROUND
+	if (use_displist == -1) {
+		use_displist = !GPU_type_matches(GPU_DEVICE_ANY, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE);
+	}
+#endif
+
+	if (displist == 0 || use_displist == 0) {
+		GLUquadricObj *qobj;
+
+		if (use_displist) {
+			displist = glGenLists(1);
+			glNewList(displist, GL_COMPILE_AND_EXECUTE);
+		}
 		
-		displist = glGenLists(1);
-		glNewList(displist, GL_COMPILE_AND_EXECUTE);
-		
 		qobj = gluNewQuadric();
-		gluQuadricDrawStyle(qobj, GLU_FILL); 
+		gluQuadricDrawStyle(qobj, GLU_FILL);
 		glShadeModel(GL_SMOOTH);
 		gluSphere(qobj, 100.0, 32, 24);
 		glShadeModel(GL_FLAT);
 		gluDeleteQuadric(qobj);  
 		
-		glEndList();
+		if (use_displist) {
+			glEndList();
+		}
 	}
 	else {
 		glCallList(displist);




More information about the Bf-blender-cvs mailing list