src/solaris/native/sun/java2d/x11/X11SurfaceData.c
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 63,73 ****
static GetRasInfoFunc X11SD_GetRasInfo;
static UnlockFunc X11SD_Unlock;
static DisposeFunc X11SD_Dispose;
static GetPixmapBgFunc X11SD_GetPixmapWithBg;
static ReleasePixmapBgFunc X11SD_ReleasePixmapWithBg;
- extern int J2DXErrHandler(Display *display, XErrorEvent *xerr);
extern AwtGraphicsConfigDataPtr
getGraphicsConfigFromComponentPeer(JNIEnv *env, jobject this);
extern struct X11GraphicsConfigIDs x11GraphicsConfigIDs;
static int X11SD_FindClip(SurfaceDataBounds *b, SurfaceDataBounds *bounds,
--- 63,72 ----
*** 557,586 ****
return NULL;
}
shminfo->readOnly = False;
! resetXShmAttachFailed();
! EXEC_WITH_XERROR_HANDLER(J2DXErrHandler,
! XShmAttach(awt_display, shminfo));
/*
* Once the XSync round trip has finished then we
* can get rid of the id so that this segment does not stick
* around after we go away, holding system resources.
*/
shmctl(shminfo->shmid, IPC_RMID, 0);
! if (isXShmAttachFailed() == JNI_TRUE) {
J2dRlsTraceLn1(J2D_TRACE_ERROR,
"X11SD_SetupSharedSegment XShmAttach has failed: %s",
strerror(errno));
shmdt(shminfo->shmaddr);
free((void *)shminfo);
XDestroyImage(img);
return NULL;
}
img->data = shminfo->shmaddr;
img->obdata = (char *)shminfo;
return img;
--- 556,594 ----
return NULL;
}
shminfo->readOnly = False;
! JNIEnv* env = (JNIEnv*)JNU_GetEnv(jvm, JNI_VERSION_1_2);
! AWT_LOCK();
!
! jobject xShmAttachHandler = JNU_CallStaticMethodByName(env, NULL, "sun/awt/X11/XErrorHandler$XShmAttachHandler",
! "getInstance", "()Lsun/awt/X11/XErrorHandler$XShmAttachHandler;").l;
! JNU_CallMethodByName(env, NULL, xShmAttachHandler, "setErrorOccurredFlag", "(Z)V", JNI_FALSE);
! JNU_CallStaticMethodByName(env, NULL, "sun/awt/X11/XErrorHandlerUtil", "WITH_XERROR_HANDLER",
! "(Lsun/awt/X11/XErrorHandler;)V", xShmAttachHandler);
! XShmAttach(awt_display, shminfo);
! JNU_CallStaticMethodByName(env, NULL, "sun/awt/X11/XErrorHandlerUtil", "RESTORE_XERROR_HANDLER", "()V");
/*
* Once the XSync round trip has finished then we
* can get rid of the id so that this segment does not stick
* around after we go away, holding system resources.
*/
shmctl(shminfo->shmid, IPC_RMID, 0);
! if (JNU_CallMethodByName(env, NULL, xShmAttachHandler, "getErrorOccurredFlag", "()Z").z == JNI_TRUE) {
J2dRlsTraceLn1(J2D_TRACE_ERROR,
"X11SD_SetupSharedSegment XShmAttach has failed: %s",
strerror(errno));
shmdt(shminfo->shmaddr);
free((void *)shminfo);
XDestroyImage(img);
+ AWT_UNLOCK();
return NULL;
}
+ AWT_UNLOCK();
img->data = shminfo->shmaddr;
img->obdata = (char *)shminfo;
return img;