Fix memory leaks

This commit is contained in:
Pieter de Bie
2008-11-26 17:02:23 +01:00
parent 2bab86cf32
commit 3dd6385440
8 changed files with 34 additions and 0 deletions
+5
View File
@@ -30,6 +30,11 @@
[cachedFilesController setSortDescriptors:[NSArray arrayWithObject:
[[NSSortDescriptor alloc] initWithKey:@"path" ascending:true]]];
}
- (void) removeView
{
[webController closeView];
[super finalize];
}
- (void) setAmend:(BOOL)newAmend
{
+4
View File
@@ -190,6 +190,10 @@
- (void) removeView
{
[webView close];
[commitController removeObserver:self forKeyPath:@"selection"];
[treeController removeObserver:self forKeyPath:@"selection"];
[repository removeObserver:self forKeyPath:@"currentBranch"];
[super removeView];
}
+5
View File
@@ -375,4 +375,9 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain";
return nil;
}
- (void) finalize
{
NSLog(@"Dealloc of repository");
[super finalize];
}
@end
+6
View File
@@ -33,6 +33,11 @@
return self;
}
- (void)windowWillClose:(NSNotification *)notification
{
[viewController removeView];
}
- (void) setSelectedViewIndex: (int) i
{
selectedViewIndex = i;
@@ -70,6 +75,7 @@
- (void)awakeFromNib
{
[[self window] setDelegate:self];
[[self window] setAutorecalculatesContentBorderThickness:NO forEdge:NSMinYEdge];
[[self window] setContentBorderThickness:35.0f forEdge:NSMinYEdge];
[self showHistoryView:nil];
+1
View File
@@ -27,6 +27,7 @@
- (void) removeView
{
[self unbind:@"repository"];
[[self view] removeFromSuperview]; // remove the current view
}
+1
View File
@@ -25,4 +25,5 @@
@property (retain) id repository;
- (WebScriptObject *) script;
- (void) closeView;
@end
+6
View File
@@ -35,6 +35,12 @@
return [view windowScriptObject];
}
- (void) closeView
{
if (view)
[view close];
}
# pragma mark Delegate methods
- (void) webView:(id) v didFinishLoadForFrame:(id) frame
+6
View File
@@ -108,4 +108,10 @@ contextMenuItemsForElement:(NSDictionary *)element
return [historyController valueForKeyPath:[@"repository.config." stringByAppendingString:config]];
}
- (void) finalize
{
[historyController removeObserver:self forKeyPath:@"webCommit"];
[super finalize];
}
@end