changeset 11886:59903dbf4122

8156116: [macosx] two JNI locals to delete in AWTWindow.m, CGraphicsEnv.m Reviewed-by: serb, azvegint
author ant
date Tue, 20 Sep 2016 15:53:06 +0300
parents c4b627243347
children 79aaa0f7f81a
files src/macosx/native/sun/awt/AWTWindow.m src/macosx/native/sun/awt/CGraphicsEnv.m
diffstat 2 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/macosx/native/sun/awt/AWTWindow.m	Thu Sep 15 11:44:12 2016 +0300
+++ b/src/macosx/native/sun/awt/AWTWindow.m	Tue Sep 20 15:53:06 2016 +0300
@@ -821,9 +821,12 @@
             if (p.y >= (frame.origin.y + contentRect.size.height)) {
                 JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
                 jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env];
-                // Currently, no need to deliver the whole NSEvent.
-                static JNF_MEMBER_CACHE(jm_deliverNCMouseDown, jc_CPlatformWindow, "deliverNCMouseDown", "()V");
-                JNFCallVoidMethod(env, platformWindow, jm_deliverNCMouseDown);
+                if (platformWindow != NULL) {
+                    // Currently, no need to deliver the whole NSEvent.
+                    static JNF_MEMBER_CACHE(jm_deliverNCMouseDown, jc_CPlatformWindow, "deliverNCMouseDown", "()V");
+                    JNFCallVoidMethod(env, platformWindow, jm_deliverNCMouseDown);
+                    (*env)->DeleteLocalRef(env, platformWindow);
+                }
             }
         }
 }
--- a/src/macosx/native/sun/awt/CGraphicsEnv.m	Thu Sep 15 11:44:12 2016 +0300
+++ b/src/macosx/native/sun/awt/CGraphicsEnv.m	Tue Sep 20 15:53:06 2016 +0300
@@ -146,6 +146,7 @@
                     jc_CGraphicsEnvironment, "_displayReconfiguration","(IZ)V");
             JNFCallVoidMethod(env, graphicsEnv, jm_displayReconfiguration,
                     (jint) display, (jboolean) flags & kCGDisplayRemoveFlag);
+            (*env)->DeleteLocalRef(env, graphicsEnv);
         });
     }];
 }