Fixed the positioning hang.
authorPeter Hosey <hg@boredzo.org>
Mon Feb 08 03:33:24 2010 -0800 (2010-02-08)
changeset 45834a2eb058f472
parent 4582 5fa091ae672c
child 4584 ebecc7e46697
Fixed the positioning hang.

When we encounter a display window controller we're ignoring, we need to subtract 1 from the count, since we're not going to include this rect in the output array. If we don't (as we didn't), the last element of the output array is garbage.
Core/Source/GrowlPositionController.m
     1.1 --- a/Core/Source/GrowlPositionController.m	Mon Feb 08 03:31:42 2010 -0800
     1.2 +++ b/Core/Source/GrowlPositionController.m	Mon Feb 08 03:33:24 2010 -0800
     1.3 @@ -510,16 +510,18 @@
     1.4  	NSValue		 *value;
     1.5  	NSValue		 *displayControllerValue = [NSValue valueWithPointer:displayController];
     1.6  	NSUInteger	  count = [rectSet count];
     1.7 -	
     1.8 -	if (outCount) *outCount = count;
     1.9  
    1.10  	NSRectArray gridRects = (NSRectArray)malloc(sizeof(NSRect) * count);
    1.11  	int i = 0;
    1.12  	while ((value = [enumerator nextObject])) {
    1.13 -		if (!displayController || (![[reservedRectsByController objectForKey:displayControllerValue] isEqual:value])) {
    1.14 +		if (displayController && [[reservedRectsByController objectForKey:displayControllerValue] isEqual:value]) {
    1.15 +			--count;
    1.16 +		} else {
    1.17  			gridRects[i++] = NSInsetRect([value rectValue], -padding, -padding);
    1.18  		}
    1.19  	}
    1.20 +
    1.21 +	if (outCount) *outCount = count;
    1.22  	
    1.23  	return gridRects;
    1.24  }