changeset 3777:bbbf427a9007

6974985: Jave2Demo threw exceptions when xrender enabled in OEL5.5 Reviewed-by: prr
author ceisserer
date Tue, 01 Mar 2011 14:49:53 -0800
parents 196d6e802721
children 01dcb496946e
files make/sun/awt/mapfile-mawt-vers make/sun/xawt/mapfile-vers src/solaris/classes/sun/java2d/xr/XRSurfaceData.java src/solaris/native/sun/java2d/x11/X11SurfaceData.c src/solaris/native/sun/java2d/x11/XRSurfaceData.c
diffstat 5 files changed, 44 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/make/sun/awt/mapfile-mawt-vers	Mon Feb 28 10:25:17 2011 -0800
+++ b/make/sun/awt/mapfile-mawt-vers	Tue Mar 01 14:49:53 2011 -0800
@@ -424,6 +424,7 @@
 		Java_sun_java2d_xr_XRSurfaceData_initXRPicture;
 		Java_sun_java2d_xr_XRSurfaceData_initIDs;
 		Java_sun_java2d_xr_XRSurfaceData_XRInitSurface;
+		Java_sun_java2d_xr_XRSurfaceData_freeXSDOPicture;
 		Java_sun_java2d_xr_XRBackendNative_initIDs;
 		Java_sun_java2d_xr_XIDGenerator_bufferXIDs;
 		Java_sun_java2d_xr_XRBackendNative_freeGC;
--- a/make/sun/xawt/mapfile-vers	Mon Feb 28 10:25:17 2011 -0800
+++ b/make/sun/xawt/mapfile-vers	Tue Mar 01 14:49:53 2011 -0800
@@ -374,6 +374,7 @@
         Java_sun_java2d_xr_XRSurfaceData_initXRPicture;
         Java_sun_java2d_xr_XRSurfaceData_initIDs;
         Java_sun_java2d_xr_XRSurfaceData_XRInitSurface;
+	Java_sun_java2d_xr_XRSurfaceData_freeXSDOPicture;
 	Java_sun_java2d_xr_XRBackendNative_initIDs;
 	Java_sun_java2d_xr_XRBackendNative_freeGC;
 	Java_sun_java2d_xr_XRBackendNative_createGC;
--- a/src/solaris/classes/sun/java2d/xr/XRSurfaceData.java	Mon Feb 28 10:25:17 2011 -0800
+++ b/src/solaris/classes/sun/java2d/xr/XRSurfaceData.java	Tue Mar 01 14:49:53 2011 -0800
@@ -55,6 +55,8 @@
 
     native void initXRPicture(long xsdo, int pictForm);
 
+    native void freeXSDOPicture(long xsdo);
+
     public static final String DESC_BYTE_A8_X11 = "Byte A8 Pixmap";
     public static final String DESC_INT_RGB_X11 = "Integer RGB Pixmap";
     public static final String DESC_INT_ARGB_X11 = "Integer ARGB-Pre Pixmap";
@@ -531,6 +533,17 @@
         public Object getDestination() {
             return peer.getTarget();
         }
+
+       public void invalidate() {
+           try {
+               SunToolkit.awtLock();
+               freeXSDOPicture(getNativeOps());
+           }finally {
+               SunToolkit.awtUnlock();
+           }
+
+           super.invalidate();
+       }
     }
 
     public static class XRInternalSurfaceData extends XRSurfaceData {
--- a/src/solaris/native/sun/java2d/x11/X11SurfaceData.c	Mon Feb 28 10:25:17 2011 -0800
+++ b/src/solaris/native/sun/java2d/x11/X11SurfaceData.c	Tue Mar 01 14:49:53 2011 -0800
@@ -375,6 +375,12 @@
     AWT_LOCK();
 
     xsdo->invalid = JNI_TRUE;
+
+    if (xsdo->xrPic != None) {
+        XRenderFreePicture(awt_display, xsdo->xrPic);
+        xsdo->xrPic = None;
+     }
+
     if (xsdo->isPixmap == JNI_TRUE && xsdo->drawable != 0) {
 #ifdef MITSHM
         if (xsdo->shmPMData.shmSegInfo != NULL) {
--- a/src/solaris/native/sun/java2d/x11/XRSurfaceData.c	Mon Feb 28 10:25:17 2011 -0800
+++ b/src/solaris/native/sun/java2d/x11/XRSurfaceData.c	Tue Mar 01 14:49:53 2011 -0800
@@ -114,3 +114,26 @@
     XShared_initSurface(env, xsdo, depth, width, height, drawable);
 #endif /* !HEADLESS */
 }
+
+
+
+JNIEXPORT void JNICALL
+Java_sun_java2d_xr_XRSurfaceData_freeXSDOPicture(JNIEnv *env, jobject xsd,
+                                                  jlong pXSData)
+{
+#ifndef HEADLESS
+    X11SDOps *xsdo;
+
+    J2dTraceLn(J2D_TRACE_INFO, "in XRSurfaceData_freeXSDOPicture");
+
+    xsdo = X11SurfaceData_GetOps(env, xsd);
+    if (xsdo == NULL) {
+        return;
+    }
+
+    if(xsdo->xrPic != None) {
+       XRenderFreePicture(awt_display, xsdo->xrPic);
+       xsdo->xrPic = None;
+    }
+#endif /* !HEADLESS */
+}