changeset 17256:b75e2210e090

8162097: [PIT] A series of closed tests about SunFontManager throw NPE on Windows Reviewed-by: bpb, serb
author prr
date Mon, 25 Jul 2016 15:09:23 -0700
parents 233b59b7ea2f
children 42a74b67c5bb
files src/java.desktop/windows/native/libfontmanager/fontpath.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/windows/native/libfontmanager/fontpath.c	Mon Jul 18 15:43:30 2016 -0500
+++ b/src/java.desktop/windows/native/libfontmanager/fontpath.c	Mon Jul 25 15:09:23 2016 -0700
@@ -305,8 +305,8 @@
     familyLC = (*env)->CallObjectMethod(env, fmi->family,
                                         fmi->toLowerCaseMID, fmi->locale);
     /* Delete the created reference after its usage */
-    DeleteLocalReference(env, fmi->family);
     if ((*env)->ExceptionCheck(env)) {
+        DeleteLocalReference(env, fmi->family);
         return 0;
     }
 
@@ -317,10 +317,12 @@
                                                    familyLC);
     if ((*env)->ExceptionCheck(env)) {
         /* Delete the created references before return */
+        DeleteLocalReference(env, fmi->family);
         DeleteLocalReference(env, familyLC);
         return 0;
     } else if (mapHasKey) {
         /* Delete the created references before return */
+        DeleteLocalReference(env, fmi->family);
         DeleteLocalReference(env, familyLC);
         return 1;
     }
@@ -329,6 +331,7 @@
                                   fmi->arrayListClass, fmi->arrayListCtr, 4);
     if (fmi->list == NULL) {
         /* Delete the created references before return */
+        DeleteLocalReference(env, fmi->family);
         DeleteLocalReference(env, familyLC);
         return 0;
     }
@@ -339,6 +342,7 @@
     DeleteLocalReference(env, familyLC);
     if ((*env)->ExceptionCheck(env)) {
         /* Delete the created reference before return */
+        DeleteLocalReference(env, fmi->family);
         DeleteLocalReference(env, fmi->list);
         return 0;
     }
@@ -351,6 +355,7 @@
                         lParam, 0L);
 
     /* Delete the created reference after its usage in the enum function */
+    DeleteLocalReference(env, fmi->family);
     DeleteLocalReference(env, fmi->list);
     return 1;
 }