Commits

Brandon Walkin  committed c9c2169

Selectable toolbar - fixed some leaks

  • Participants
  • Parent commits e9844d1

Comments (0)

Files changed (1)

File BWSelectableToolbar.m

 	if ([self isMemberOfClass:NSClassFromString(@"IBEditableBWSelectableToolbar")])
 	{
 		// When the toolbar is initially dragged onto the canvas, record the content view and size of the window		
-		NSMutableDictionary *tempCVBI = [[helper contentViewsByIdentifier] mutableCopy];
+		NSMutableDictionary *tempCVBI = [[[helper contentViewsByIdentifier] mutableCopy] autorelease];
 		[tempCVBI setObject:[[[self editableToolbar] _window] contentView] forKey:[helper selectedIdentifier]];
 		[helper setContentViewsByIdentifier:tempCVBI];
 		
-		NSMutableDictionary *tempWSBI = [[helper windowSizesByIdentifier] mutableCopy];	
+		NSMutableDictionary *tempWSBI = [[[helper windowSizesByIdentifier] mutableCopy] autorelease];	
 		[tempWSBI setObject:[NSValue valueWithSize:[[[self editableToolbar] _window] frame].size] forKey:[helper selectedIdentifier]];
 		[helper setWindowSizesByIdentifier:tempWSBI];
 	}
 
 - (void)setEnabled:(BOOL)flag forIdentifier:(NSString *)itemIdentifier
 {
-	NSMutableDictionary *enabledDict = [[self enabledByIdentifier] mutableCopy];
+	NSMutableDictionary *enabledDict = [[[self enabledByIdentifier] mutableCopy] autorelease];
 	
 	[enabledDict setObject:[NSNumber numberWithBool:flag] forKey:itemIdentifier];
 	
 	
 	if ([helper selectedIdentifier])
 	{
-		NSMutableDictionary *tempWSBI = [[helper windowSizesByIdentifier] mutableCopy];	
+		NSMutableDictionary *tempWSBI = [[[helper windowSizesByIdentifier] mutableCopy] autorelease];	
 		[tempWSBI setObject:sizeValue forKey:key];
 		[helper setWindowSizesByIdentifier:tempWSBI];
 	}
 	[(BWSelectableToolbar *)[self editableToolbar] selectItemAtIndex:anIndex];
 
 	// Make a new container view and add it to the IB document
-	NSView *containerView = [[NSView alloc] initWithFrame:[[[[self editableToolbar] _window] contentView] frame]];
+	NSView *containerView = [[[NSView alloc] initWithFrame:[[[[self editableToolbar] _window] contentView] frame]] autorelease];
 	if (inIB)
 		[self addObject:containerView toParent:[self parentOfObject:self]];
 	
 	}
 	
 	// Store the container view and window size in the dictionaries
-	NSMutableDictionary *tempCVBI = [[helper contentViewsByIdentifier] mutableCopy];
+	NSMutableDictionary *tempCVBI = [[[helper contentViewsByIdentifier] mutableCopy] autorelease];
 	[tempCVBI setObject:containerView forKey:oldIdentifier];
 	[helper setContentViewsByIdentifier:tempCVBI];
 	
 	NSSize oldWindowSize = [[[self editableToolbar] _window] frame].size;
-	NSMutableDictionary *tempWSBI = [[helper windowSizesByIdentifier] mutableCopy];
+	NSMutableDictionary *tempWSBI = [[[helper windowSizesByIdentifier] mutableCopy] autorelease];
 	[tempWSBI setObject:[NSValue valueWithSize:oldWindowSize] forKey:oldIdentifier];
 	[helper setWindowSizesByIdentifier:tempWSBI];
 
 		// Record the new tab content view and window size
 		if (inIB)
 		{
-			NSMutableDictionary *tempCVBI = [[helper contentViewsByIdentifier] mutableCopy];
+			NSMutableDictionary *tempCVBI = [[[helper contentViewsByIdentifier] mutableCopy] autorelease];
 			[tempCVBI setObject:[[[self editableToolbar] _window] contentView] forKey:newIdentifier];
 			[helper setContentViewsByIdentifier:tempCVBI];
 			
-			NSMutableDictionary *tempWSBI = [[helper windowSizesByIdentifier] mutableCopy];	
+			NSMutableDictionary *tempWSBI = [[[helper windowSizesByIdentifier] mutableCopy] autorelease];	
 			[tempWSBI setObject:[NSValue valueWithSize:[[[self editableToolbar] _window] frame].size] forKey:newIdentifier];
 			[helper setWindowSizesByIdentifier:tempWSBI];
 		}