blob: 4157bb6bac4931f701ff2459a0e07aba65c7fb35 [file] [log] [blame]
# HG changeset patch
# User andrew
# Date 1438275152 -3600
# Node ID a2334007f1a8504d2bd4a2c2a037732c289649c3
# Parent ab23850139cb2c666e613010842a1f984b184a3a
PR2568: openjdk causes a full desktop crash on RHEL 6 i586
Summary: Re-apply "8025775: JNI warnings in TryXShmAttach"; some changes lost in bad merge changeset 4b26f93b23ba
diff -r ab23850139cb -r a2334007f1a8 src/solaris/classes/sun/awt/X11/XConstants.java
--- openjdk/jdk/src/solaris/classes/sun/awt/X11/XConstants.java Wed Oct 23 10:50:34 2013 +0200
+++ openjdk/jdk/src/solaris/classes/sun/awt/X11/XConstants.java Thu Jul 30 17:52:32 2015 +0100
@@ -699,9 +699,4 @@
public static final long XkbModifierMapMask = (1L<<2);
public static final long XkbVirtualModsMask = (1L<<6); //server map
- /*****************************************************************
- * X SHARED MEMORY EXTENSION FUNCTIONS
- *****************************************************************/
-
- public static final int X_ShmAttach = 1;
}
diff -r ab23850139cb -r a2334007f1a8 src/solaris/classes/sun/awt/X11/XErrorHandler.java
--- openjdk/jdk/src/solaris/classes/sun/awt/X11/XErrorHandler.java Wed Oct 23 10:50:34 2013 +0200
+++ openjdk/jdk/src/solaris/classes/sun/awt/X11/XErrorHandler.java Thu Jul 30 17:52:32 2015 +0100
@@ -41,29 +41,6 @@
return XErrorHandlerUtil.SAVED_XERROR_HANDLER(display, err);
}
}
-
- /**
- * This is a base synthetic error handler containing a boolean flag which allows
- * to show that an error is handled or not.
- */
- public static class XErrorHandlerWithFlag extends XBaseErrorHandler {
- private volatile boolean errorOccurred = false;
-
- public boolean getErrorOccurredFlag() {
- return errorOccurred;
- }
-
- /**
- * Sets an internal boolean flag to a particular value. Should be always called
- * with {@code false} value of the parameter {@code errorOccurred} before this
- * error handler is set as current.
- * @param errorOccurred {@code true} to indicate that an error was handled,
- * {@code false} to reset the internal boolean flag
- */
- public void setErrorOccurredFlag(boolean errorOccurred) {
- this.errorOccurred = errorOccurred;
- }
- }
/*
* Instead of validating window id, we simply call XGetWindowProperty,
@@ -99,75 +76,4 @@
return theInstance;
}
}
-
- /**
- * This is a synthetic error handler for errors generated by the native function
- * {@code XShmAttach}. If an error is handled, an internal boolean flag of the
- * handler is set to {@code true}.
- */
- public static final class XShmAttachHandler extends XErrorHandlerWithFlag {
- private XShmAttachHandler() {}
-
- @Override
- public int handleError(long display, XErrorEvent err) {
- if (err.get_minor_code() == XConstants.X_ShmAttach) {
- setErrorOccurredFlag(true);
- return 0;
- }
- return super.handleError(display, err);
- }
-
- // Shared instance
- private static XShmAttachHandler theInstance = new XShmAttachHandler();
- public static XShmAttachHandler getInstance() {
- return theInstance;
- }
- }
-
- /**
- * This is a synthetic error handler for {@code BadAlloc} errors generated by the
- * native {@code glX*} functions. Its internal boolean flag is set to {@code true},
- * if an error is handled.
- */
- public static final class GLXBadAllocHandler extends XErrorHandlerWithFlag {
- private GLXBadAllocHandler() {}
-
- @Override
- public int handleError(long display, XErrorEvent err) {
- if (err.get_error_code() == XConstants.BadAlloc) {
- setErrorOccurredFlag(true);
- return 0;
- }
- return super.handleError(display, err);
- }
-
- private static GLXBadAllocHandler theInstance = new GLXBadAllocHandler();
- public static GLXBadAllocHandler getInstance() {
- return theInstance;
- }
- }
-
- /**
- * This is a synthetic error handler for errors generated by the native function
- * {@code XChangeWindowAttributes}. If an error is handled, an internal boolean
- * flag of the handler is set to {@code true}.
- */
- public static final class XChangeWindowAttributesHandler extends XErrorHandlerWithFlag {
- private XChangeWindowAttributesHandler() {}
-
- @Override
- public int handleError(long display, XErrorEvent err) {
- if ((err.get_request_code() == XProtocolConstants.X_ChangeWindowAttributes) &&
- (err.get_error_code() == XConstants.BadAccess)) {
- setErrorOccurredFlag(true);
- return 0;
- }
- return super.handleError(display, err);
- }
-
- private static XChangeWindowAttributesHandler theInstance = new XChangeWindowAttributesHandler();
- public static XChangeWindowAttributesHandler getInstance() {
- return theInstance;
- }
- }
}
diff -r ab23850139cb -r a2334007f1a8 src/solaris/native/sun/awt/awt_GraphicsEnv.h
--- openjdk/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.h Wed Oct 23 10:50:34 2013 +0200
+++ openjdk/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.h Thu Jul 30 17:52:32 2015 +0100
@@ -54,7 +54,7 @@
void TryInitMITShm(JNIEnv *env, jint *shmExt, jint *shmPixmaps);
void resetXShmAttachFailed();
-jboolean TryXShmAttach(JNIEnv *env, Display *display, XShmSegmentInfo *shminfo);
+jboolean isXShmAttachFailed();
#endif /* MITSHM */
diff -r ab23850139cb -r a2334007f1a8 src/solaris/native/sun/awt/awt_xembed_server.c
--- openjdk/jdk/src/solaris/native/sun/awt/awt_xembed_server.c Wed Oct 23 10:50:34 2013 +0200
+++ openjdk/jdk/src/solaris/native/sun/awt/awt_xembed_server.c Thu Jul 30 17:52:32 2015 +0100
@@ -644,19 +644,12 @@
return dim;
}
-Boolean isMapped(JNIEnv* env, Window w) {
+Boolean isMapped(Window w) {
XWindowAttributes attr;
Status status = 0;
- jboolean errorOccurredFlag;
- jobject errorHandlerRef;
- jobject savedError;
- unsigned char xerror_code;
-
- EXEC_WITH_XERROR_HANDLER(env, "sun/awt/X11/XErrorHandler$IgnoreBadWindowHandler",
- "()Lsun/awt/X11/XErrorHandler$IgnoreBadWindowHandler;", JNI_FALSE,
- errorHandlerRef, errorOccurredFlag,
- status = XGetWindowAttributes(awt_display, w, &attr));
- xerror_code = GET_XERROR_CODE(env, savedError);
+ WITH_XERROR_HANDLER(xerror_ignore_bad_window);
+ status = XGetWindowAttributes(awt_display, w, &attr);
+ RESTORE_XERROR_HANDLER;
if (status == 0 || xerror_code != Success) {
return False;
}
@@ -692,7 +685,7 @@
sdata->version = *data;
flags = *(data+1);
new_mapped = (flags & XEMBED_MAPPED) != 0;
- currently_mapped = isMapped(env, sdata->handle);
+ currently_mapped = isMapped(sdata->handle);
if (new_mapped != currently_mapped) {
if (new_mapped) {
XMapWindow(awt_display, sdata->handle);
diff -r ab23850139cb -r a2334007f1a8 src/solaris/native/sun/java2d/x11/X11SurfaceData.c
--- openjdk/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c Wed Oct 23 10:50:34 2013 +0200
+++ openjdk/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c Thu Jul 30 17:52:32 2015 +0100
@@ -551,8 +551,6 @@
{
XImage *img = NULL;
XShmSegmentInfo *shminfo;
- JNIEnv* env;
- jboolean xShmAttachResult;
shminfo = malloc(sizeof(XShmSegmentInfo));
if (shminfo == NULL) {
@@ -603,7 +601,7 @@
*/
shmctl(shminfo->shmid, IPC_RMID, 0);
- if (xShmAttachResult == JNI_FALSE) {
+ if (isXShmAttachFailed() == JNI_TRUE) {
J2dRlsTraceLn1(J2D_TRACE_ERROR,
"X11SD_SetupSharedSegment XShmAttach has failed: %s",
strerror(errno));