changeset 8357:e0afb6ec0633 jdk7u75-b07

8041572: [macosx] huge native memory leak in AWTWindow.m Reviewed-by: pchelko, serb
author mcherkas
date Wed, 29 Oct 2014 23:33:38 +0400
parents 0818328db649
children ab38de897d40
files src/macosx/native/sun/awt/AWTWindow.m
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/macosx/native/sun/awt/AWTWindow.m	Wed Jul 23 20:14:02 2014 +0100
+++ b/src/macosx/native/sun/awt/AWTWindow.m	Wed Oct 29 23:33:38 2014 +0400
@@ -316,7 +316,8 @@
 
 // return id for the topmost window under mouse
 + (NSInteger) getTopmostWindowUnderMouseID {
-
+    NSInteger result = -1;
+    
     NSRect screenRect = [[NSScreen mainScreen] frame];
     NSPoint nsMouseLocation = [NSEvent mouseLocation];
     CGPoint cgMouseLocation = CGPointMake(nsMouseLocation.x, screenRect.size.height - nsMouseLocation.y);
@@ -330,11 +331,13 @@
             CGRect rect;
             CGRectMakeWithDictionaryRepresentation((CFDictionaryRef)[window objectForKey:(id)kCGWindowBounds], &rect);
             if (CGRectContainsPoint(rect, cgMouseLocation)) {
-                return [[window objectForKey:(id)kCGWindowNumber] integerValue];
+                result = [[window objectForKey:(id)kCGWindowNumber] integerValue];
+                break;
             }
         }
     }
-    return -1;
+    [windows release];
+    return result;
 }
 
 // checks that this window is under the mouse cursor and this point is not overlapped by other windows