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 ----
*** 519,528 ****
--- 518,529 ----
XImage* X11SD_CreateSharedImage(X11SDOps *xsdo,
jint width, jint height)
{
XImage *img = NULL;
XShmSegmentInfo *shminfo;
+ JNIEnv* env;
+ jboolean xShmAttachResult;
shminfo = malloc(sizeof(XShmSegmentInfo));
if (shminfo == NULL) {
return NULL;
}
*** 557,578 ****
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);
--- 558,578 ----
return NULL;
}
shminfo->readOnly = False;
! env = (JNIEnv*)JNU_GetEnv(jvm, JNI_VERSION_1_2);
! xShmAttachResult = TryXShmAttach(env, 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 (xShmAttachResult == JNI_FALSE) {
J2dRlsTraceLn1(J2D_TRACE_ERROR,
"X11SD_SetupSharedSegment XShmAttach has failed: %s",
strerror(errno));
shmdt(shminfo->shmaddr);
free((void *)shminfo);