< prev index next >

src/java.desktop/macosx/native/libawt_lwawt/font/AWTStrike.m

Print this page

        

@@ -312,26 +312,31 @@
 
     AWTStrike *awtStrike = (AWTStrike *)jlong_to_ptr(awtStrikePtr);
 
     jlong *glyphInfos =
         (*env)->GetPrimitiveArrayCritical(env, glyphInfoLongArray, NULL);
-    if (glyphInfos != NULL) {
+
         jint *rawGlyphCodes =
             (*env)->GetPrimitiveArrayCritical(env, glyphCodes, NULL);
-
-        if (rawGlyphCodes != NULL) {
+    @try {
+        if (rawGlyphCodes != NULL && glyphInfos != NULL) {
             CGGlyphImages_GetGlyphImagePtrs(glyphInfos, awtStrike,
                                             rawGlyphCodes, len);
-
+        }
+    }
+    @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);
 }
 
 /*
< prev index next >