jdk/src/macosx/native/sun/awt/AWTWindow.m
changeset 24534 07cf38b730b5
parent 24134 46d80fad2e48
child 25120 8b6a41c3752f
--- a/jdk/src/macosx/native/sun/awt/AWTWindow.m	Thu Apr 24 20:22:58 2014 +0400
+++ b/jdk/src/macosx/native/sun/awt/AWTWindow.m	Fri Apr 25 16:27:30 2014 +0400
@@ -261,7 +261,8 @@
 
 // returns 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);
@@ -274,11 +275,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 others windows