Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed BWSplitView memory leaks (using mutableCopy + autorelease)

  • Loading branch information...
commit 31797493f383cfd607724453c8751c908a5e44cf 1 parent b860893
@fabien authored
Showing with 12 additions and 12 deletions.
  1. +6 −6 BWSplitView.m
  2. +6 −6 BWSplitViewInspector.m
View
12 BWSplitView.m
@@ -328,7 +328,7 @@ - (void)setMinSizeForCollapsibleSubview:(NSNumber *)minSize
{
if ([self hasCollapsibleSubview])
{
- NSMutableDictionary *tempMinValues = [[self minValues] mutableCopy];
+ NSMutableDictionary *tempMinValues = [[[self minValues] mutableCopy] autorelease];
[tempMinValues setObject:minSize forKey:[NSNumber numberWithInt:[[self subviews] indexOfObject:[self collapsibleSubview]]]];
[self setMinValues:tempMinValues];
}
@@ -338,7 +338,7 @@ - (void)removeMinSizeForCollapsibleSubview
{
if ([self hasCollapsibleSubview])
{
- NSMutableDictionary *tempMinValues = [[self minValues] mutableCopy];
+ NSMutableDictionary *tempMinValues = [[[self minValues] mutableCopy] autorelease];
[tempMinValues removeObjectForKey:[NSNumber numberWithInt:[[self subviews] indexOfObject:[self collapsibleSubview]]]];
[self setMinValues:tempMinValues];
}
@@ -874,8 +874,8 @@ - (void)correctCollapsiblePreferredProportionOrSize;
if (![self hasCollapsibleSubview])
return;
- NSMutableDictionary *preferredProportions = [[self resizableSubviewPreferredProportion] mutableCopy];
- NSMutableDictionary *preferredSizes = [[self nonresizableSubviewPreferredSize] mutableCopy];
+ NSMutableDictionary *preferredProportions = [[[self resizableSubviewPreferredProportion] mutableCopy] autorelease];
+ NSMutableDictionary *preferredSizes = [[[self nonresizableSubviewPreferredSize] mutableCopy] autorelease];
NSNumber *key = [NSNumber numberWithInt:[self collapsibleSubviewIndex]];
NSView *subview = [self collapsibleSubview];
@@ -1037,7 +1037,7 @@ - (void)resizeAndAdjustSubviews;
// TODO: Could add a special case for resizableSubviewsTotalAvailableSize <= 0 : just set all resizable subviews to minimum size
// Make array of all the resizable subviews indexes
- NSMutableArray *resizableSubviewIndexes = [[resizableSubviewPreferredProportion allKeys] mutableCopy];
+ NSMutableArray *resizableSubviewIndexes = [[[resizableSubviewPreferredProportion allKeys] mutableCopy] autorelease];
[resizableSubviewIndexes sortUsingDescriptors:[NSArray arrayWithObject:[[[NSSortDescriptor alloc] initWithKey:@"self" ascending:YES] autorelease]]];
// Loop until none of the resizable subviews' constraints are violated
@@ -1143,7 +1143,7 @@ - (void)resizeAndAdjustSubviews;
if (RESIZE_DEBUG_LOGS) NSLog(@"newSubviewSizes after nonresizable proportional resizing: %@", newSubviewSizes);
// Make array of all the non-resizable subviews indexes
- NSMutableArray *nonresizableSubviewIndexes = [[nonresizableSubviewPreferredSize allKeys] mutableCopy];
+ NSMutableArray *nonresizableSubviewIndexes = [[[nonresizableSubviewPreferredSize allKeys] mutableCopy] autorelease];
[nonresizableSubviewIndexes sortUsingDescriptors:[NSArray arrayWithObject:[[[NSSortDescriptor alloc] initWithKey:@"self" ascending:YES] autorelease]]];
// Loop until none of the non-resizable subviews' constraints are violated
View
12 BWSplitViewInspector.m
@@ -193,7 +193,7 @@ - (void)setMinUnitPopupSelection:(int)index
NSNumber *minUnit = [NSNumber numberWithInt:index];
- NSMutableDictionary *tempMinUnits = [[splitView minUnits] mutableCopy];
+ NSMutableDictionary *tempMinUnits = [[[splitView minUnits] mutableCopy] autorelease];
[tempMinUnits setObject:minUnit forKey:[NSNumber numberWithInt:[self subviewPopupSelection]]];
[splitView setMinUnits:tempMinUnits];
}
@@ -204,7 +204,7 @@ - (void)setMaxUnitPopupSelection:(int)index
NSNumber *maxUnit = [NSNumber numberWithInt:index];
- NSMutableDictionary *tempMaxUnits = [[splitView maxUnits] mutableCopy];
+ NSMutableDictionary *tempMaxUnits = [[[splitView maxUnits] mutableCopy] autorelease];
[tempMaxUnits setObject:maxUnit forKey:[NSNumber numberWithInt:[self subviewPopupSelection]]];
[splitView setMaxUnits:tempMaxUnits];
}
@@ -216,13 +216,13 @@ - (void)controlTextDidChange:(NSNotification *)aNotification
if ([minField stringValue] != nil && [[minField stringValue] isEqualToString:@""] == NO && [[minField stringValue] isEqualToString:@" "] == NO)
{
NSNumber *minValue = [NSNumber numberWithInt:[minField intValue]];
- NSMutableDictionary *tempMinValues = [[splitView minValues] mutableCopy];
+ NSMutableDictionary *tempMinValues = [[[splitView minValues] mutableCopy] autorelease];
[tempMinValues setObject:minValue forKey:[NSNumber numberWithInt:[self subviewPopupSelection]]];
[splitView setMinValues:tempMinValues];
}
else
{
- NSMutableDictionary *tempMinValues = [[splitView minValues] mutableCopy];
+ NSMutableDictionary *tempMinValues = [[[splitView minValues] mutableCopy] autorelease];
[tempMinValues removeObjectForKey:[NSNumber numberWithInt:[self subviewPopupSelection]]];
[splitView setMinValues:tempMinValues];
}
@@ -232,13 +232,13 @@ - (void)controlTextDidChange:(NSNotification *)aNotification
if ([maxField stringValue] != nil && [[maxField stringValue] isEqualToString:@""] == NO && [[maxField stringValue] isEqualToString:@" "] == NO)
{
NSNumber *maxValue = [NSNumber numberWithInt:[maxField intValue]];
- NSMutableDictionary *tempMaxValues = [[splitView maxValues] mutableCopy];
+ NSMutableDictionary *tempMaxValues = [[[splitView maxValues] mutableCopy] autorelease];
[tempMaxValues setObject:maxValue forKey:[NSNumber numberWithInt:[self subviewPopupSelection]]];
[splitView setMaxValues:tempMaxValues];
}
else
{
- NSMutableDictionary *tempMaxValues = [[splitView maxValues] mutableCopy];
+ NSMutableDictionary *tempMaxValues = [[[splitView maxValues] mutableCopy] autorelease];
[tempMaxValues removeObjectForKey:[NSNumber numberWithInt:[self subviewPopupSelection]]];
[splitView setMaxValues:tempMaxValues];
}
Please sign in to comment.
Something went wrong with that request. Please try again.