--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/AWTStrike.m Fri May 29 08:58:46 2015 +0900
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/AWTStrike.m Fri May 29 18:32:58 2015 +0300
@@ -311,21 +311,26 @@
jlong *glyphInfos =
(*env)->GetPrimitiveArrayCritical(env, glyphInfoLongArray, NULL);
- if (glyphInfos != NULL) {
- jint *rawGlyphCodes =
+
+ jint *rawGlyphCodes =
(*env)->GetPrimitiveArrayCritical(env, glyphCodes, NULL);
-
- if (rawGlyphCodes != NULL) {
+ @try {
+ if (rawGlyphCodes != NULL && glyphInfos != NULL) {
CGGlyphImages_GetGlyphImagePtrs(glyphInfos, awtStrike,
- rawGlyphCodes, len);
-
- (*env)->ReleasePrimitiveArrayCritical(env, glyphCodes,
- rawGlyphCodes, JNI_ABORT);
+ rawGlyphCodes, len);
}
- // Do not use JNI_COMMIT, as that will not free the buffer copy
- // when +ProtectJavaHeap is on.
- (*env)->ReleasePrimitiveArrayCritical(env, glyphInfoLongArray,
- glyphInfos, 0);
+ }
+ @finally {
+ if (rawGlyphCodes != NULL) {
+ (*env)->ReleasePrimitiveArrayCritical(env, glyphCodes,
+ rawGlyphCodes, JNI_ABORT);
+ }
+ if (glyphInfos != NULL) {
+ // Do not use JNI_COMMIT, as that will not free the buffer copy
+ // when +ProtectJavaHeap is on.
+ (*env)->ReleasePrimitiveArrayCritical(env, glyphInfoLongArray,
+ glyphInfos, 0);
+ }
}
JNF_COCOA_EXIT(env);