Merge pull request #1837 from BlairDuncan/keyViewLoopInfinateLoopFix

Fixed: views from other windows cannot be next/previous key views

Previously, a view from another window could be set as the next/previous key view, which would result in unexpected behavior, including an infinite loop.

This commit ensures the proposed next/previous view belongs to the same window as the view to which it will be chained.
This commit is contained in:
aparajita
2013-03-09 08:17:52 -08:00
+2 -2
View File
@@ -2557,7 +2557,7 @@ setBoundsOrigin:
- (void)_setPreviousKeyView:(CPView)previous
{
if ([previous isEqual:self])
if ([previous isEqual:self] || ![[previous window] isEqual:[self window]])
_previousKeyView = nil;
else
_previousKeyView = previous;
@@ -2565,7 +2565,7 @@ setBoundsOrigin:
- (void)setNextKeyView:(CPView)next
{
if ([next isEqual:self])
if ([next isEqual:self] || ![[next window] isEqual:[self window]])
_nextKeyView = nil;
else
{