changeset 53187:64e7a73195c1

8215756: Memory leaks in the AWT on macOS Reviewed-by: dmarkov
author serb
date Sat, 05 Jan 2019 10:13:58 -0800
parents 5ce51ae5c0e5
children 6c8ce24d0fbf
files src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m src/java.desktop/macosx/native/libawt_lwawt/awt/CGraphicsEnv.m
diffstat 3 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m	Fri Jan 04 11:40:53 2019 +0530
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m	Sat Jan 05 10:13:58 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -142,6 +142,11 @@
         fInputMethodLOCKABLE = NULL;
     }
 
+    if (rolloverTrackingArea != nil) {
+        [self removeTrackingArea:rolloverTrackingArea];
+        [rolloverTrackingArea release];
+        rolloverTrackingArea = nil;
+    }
 
     [super dealloc];
 }
@@ -282,7 +287,7 @@
     // Allow TSM to look at the event and potentially send back NSTextInputClient messages.
     [self interpretKeyEvents:[NSArray arrayWithObject:event]];
 
-    if (fEnablePressAndHold && [event willBeHandledByComplexInputMethod] && 
+    if (fEnablePressAndHold && [event willBeHandledByComplexInputMethod] &&
         fInputMethodLOCKABLE)
     {
         fProcessingKeystroke = NO;
@@ -290,7 +295,7 @@
             fInPressAndHold = YES;
             fPAHNeedsToSelect = YES;
         } else {
-            // Abandon input to reset IM and unblock input after canceling 
+            // Abandon input to reset IM and unblock input after canceling
             // input accented symbols
 
             switch([event keyCode]) {
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m	Fri Jan 04 11:40:53 2019 +0530
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m	Sat Jan 05 10:13:58 2019 -0800
@@ -471,7 +471,7 @@
 
     JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
     [self.javaPlatformWindow setJObject:nil withEnv:env];
-
+    self.javaPlatformWindow = nil;
     self.nsWindow = nil;
     self.ownerWindow = nil;
     [super dealloc];
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/CGraphicsEnv.m	Fri Jan 04 11:40:53 2019 +0530
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/CGraphicsEnv.m	Sat Jan 05 10:13:58 2019 -0800
@@ -184,7 +184,7 @@
         return;
     }
 
-    [wrapper setJObject:NULL withEnv:env]; // more efficiant to pre-clear
+    [wrapper setJObject:NULL withEnv:env]; // more efficient to pre-clear
     [wrapper release];
 
 JNF_COCOA_EXIT(env);