diff --git a/make/sun/awt/mapfile-mawt-vers b/make/sun/awt/mapfile-mawt-vers index f1b7143e94814c5f0eabc3b58ad7601dcea0c83e..05de1fdd5343171d2fa6accf4ef2511a39efcd17 100644 --- a/make/sun/awt/mapfile-mawt-vers +++ b/make/sun/awt/mapfile-mawt-vers @@ -424,6 +424,7 @@ SUNWprivate_1.1 { 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; diff --git a/make/sun/xawt/mapfile-vers b/make/sun/xawt/mapfile-vers index 479a55a800d3736141ac5b6b44203c0a77bc0aa0..8f6ae42fe89b3ec5cdd629c94a93a56855fee7b6 100644 --- a/make/sun/xawt/mapfile-vers +++ b/make/sun/xawt/mapfile-vers @@ -374,6 +374,7 @@ SUNWprivate_1.1 { 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; diff --git a/src/solaris/classes/sun/java2d/xr/XRSurfaceData.java b/src/solaris/classes/sun/java2d/xr/XRSurfaceData.java index f09d0f3de4f8d213850e8f020866597e58cf2c1d..d8790b2cb5999e6aceda912a8b377e31f0926df1 100644 --- a/src/solaris/classes/sun/java2d/xr/XRSurfaceData.java +++ b/src/solaris/classes/sun/java2d/xr/XRSurfaceData.java @@ -55,6 +55,8 @@ public abstract class XRSurfaceData extends XSurfaceData { 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 abstract class XRSurfaceData extends XSurfaceData { 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 { diff --git a/src/solaris/native/sun/java2d/x11/X11SurfaceData.c b/src/solaris/native/sun/java2d/x11/X11SurfaceData.c index 1a715ca1369ada17b7e4c36b264a9707252a97d5..db16fdc524abed1158bd23108c0d389feec19ae1 100644 --- a/src/solaris/native/sun/java2d/x11/X11SurfaceData.c +++ b/src/solaris/native/sun/java2d/x11/X11SurfaceData.c @@ -375,6 +375,12 @@ X11SD_Dispose(JNIEnv *env, SurfaceDataOps *ops) 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) { diff --git a/src/solaris/native/sun/java2d/x11/XRSurfaceData.c b/src/solaris/native/sun/java2d/x11/XRSurfaceData.c index 83fbec0c3363a73e963035d322974867acae0ed4..620f90f7618c93ad105c2561912c264050a04a44 100644 --- a/src/solaris/native/sun/java2d/x11/XRSurfaceData.c +++ b/src/solaris/native/sun/java2d/x11/XRSurfaceData.c @@ -114,3 +114,26 @@ Java_sun_java2d_xr_XRSurfaceData_XRInitSurface(JNIEnv *env, jclass xsd, 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 */ +}