From cdbd5f157b988d33be33b2727dc2b662d4424386 Mon Sep 17 00:00:00 2001 From: stooke Date: Thu, 20 Feb 2020 06:04:27 +0000 Subject: [PATCH] 8215756: Memory leaks in the AWT on macOS Reviewed-by: shade, andrew --- src/macosx/native/sun/awt/AWTView.m | 7 ++++++- src/macosx/native/sun/awt/AWTWindow.m | 2 +- src/macosx/native/sun/awt/CGraphicsEnv.m | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/macosx/native/sun/awt/AWTView.m b/src/macosx/native/sun/awt/AWTView.m index 0cb28c8a3..29dd6410e 100644 --- a/src/macosx/native/sun/awt/AWTView.m +++ b/src/macosx/native/sun/awt/AWTView.m @@ -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 @@ -144,6 +144,11 @@ AWT_ASSERT_APPKIT_THREAD; fInputMethodLOCKABLE = NULL; } + if (rolloverTrackingArea != nil) { + [self removeTrackingArea:rolloverTrackingArea]; + [rolloverTrackingArea release]; + rolloverTrackingArea = nil; + } [super dealloc]; } diff --git a/src/macosx/native/sun/awt/AWTWindow.m b/src/macosx/native/sun/awt/AWTWindow.m index bd19d8f7e..4cc2ace5b 100644 --- a/src/macosx/native/sun/awt/AWTWindow.m +++ b/src/macosx/native/sun/awt/AWTWindow.m @@ -456,7 +456,7 @@ AWT_ASSERT_APPKIT_THREAD; JNIEnv *env = [ThreadUtilities getJNIEnvUncached]; [self.javaPlatformWindow setJObject:nil withEnv:env]; - + self.javaPlatformWindow = nil; self.nsWindow = nil; self.ownerWindow = nil; [super dealloc]; diff --git a/src/macosx/native/sun/awt/CGraphicsEnv.m b/src/macosx/native/sun/awt/CGraphicsEnv.m index cc83026b9..4815b5a65 100644 --- a/src/macosx/native/sun/awt/CGraphicsEnv.m +++ b/src/macosx/native/sun/awt/CGraphicsEnv.m @@ -203,7 +203,7 @@ JNF_COCOA_ENTER(env); 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); -- GitLab