6604044: java crashes talking to second X screen
authortdv
Wed, 14 May 2008 09:16:18 -0700
changeset 556 0aaf0da3931d
parent 555 2f69b02943f8
child 557 800259d3792b
6604044: java crashes talking to second X screen Reviewed-by: prr
jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c
--- a/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c	Tue May 13 16:57:04 2008 -0700
+++ b/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c	Wed May 14 09:16:18 2008 -0700
@@ -650,7 +650,7 @@
         if (XineramaQueryScreens != NULL) {
             DTRACE_PRINTLN("calling XineramaQueryScreens func on Linux");
             xinInfo = (*XineramaQueryScreens)(awt_display, &locNumScr);
-            if (xinInfo != NULL) {
+            if (xinInfo != NULL && locNumScr > XScreenCount(awt_display)) {
                 int32_t idx;
                 DTRACE_PRINTLN("Enabling Xinerama support");
                 usingXinerama = True;
@@ -701,7 +701,8 @@
         if (XineramaSolarisFunc != NULL) {
             DTRACE_PRINTLN("calling XineramaGetInfo func on Solaris");
             if ((*XineramaSolarisFunc)(awt_display, 0, &fbrects[0],
-                                       &fbhints[0], &locNumScr) != 0)
+                                       &fbhints[0], &locNumScr) != 0 &&
+                locNumScr > XScreenCount(awt_display))
             {
                 DTRACE_PRINTLN("Enabling Xinerama support");
                 usingXinerama = True;