changeset 8225:319ceec1d2f8

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 acb5d48ed0da
children 60862437eca9
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
@@ -320,7 +320,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);
@@ -334,11 +335,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