Commits

Anonymous committed 31dbf14

Split view - Fixed memory leaks

Comments (0)

Files changed (2)

 {
 	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];
 	}
 {
 	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];
 	}
 	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];
 	// 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
 		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

BWSplitViewInspector.m

 		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];
 		}
 		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];
 		}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.