src/solaris/native/sun/java2d/x11/X11SurfaceData.c
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * 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,11 +63,10 @@
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,
@@ -557,22 +556,22 @@
return NULL;
}
shminfo->readOnly = False;
- resetXShmAttachFailed();
- EXEC_WITH_XERROR_HANDLER(J2DXErrHandler,
- XShmAttach(awt_display, shminfo));
-
+ JNIEnv* env = (JNIEnv*)JNU_GetEnv(jvm, JNI_VERSION_1_2);
+ AWT_LOCK();
+ jboolean xShmAttachResult = TryXShmAttach(env, awt_display, shminfo);
+ AWT_UNLOCK();
/*
* 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) {
+ if (xShmAttachResult == JNI_FALSE) {
J2dRlsTraceLn1(J2D_TRACE_ERROR,
"X11SD_SetupSharedSegment XShmAttach has failed: %s",
strerror(errno));
shmdt(shminfo->shmaddr);
free((void *)shminfo);