Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From b4baba34869b3c1306634cd1329398cd3028b58c Mon Sep 17 00:00:00 2001
- From: Pieter de Bie <pdebie@ai.rug.nl>
- Date: Wed, 26 Nov 2008 17:02:23 +0100
- Subject: [PATCH] Fix memory leaks
- ---
- PBGitHistoryController.m | 4 ++++
- PBGitRepository.m | 5 +++++
- PBGitWindowController.m | 6 ++++++
- PBViewController.m | 1 +
- PBWebHistoryController.m | 6 ++++++
- 5 files changed, 22 insertions(+), 0 deletions(-)
- diff --git a/PBGitHistoryController.m b/PBGitHistoryController.m
- index 64758bb..fea0bb5 100644
- --- a/PBGitHistoryController.m
- +++ b/PBGitHistoryController.m
- @@ -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];
- }
- diff --git a/PBGitRepository.m b/PBGitRepository.m
- index 4dd33f8..a5d3a92 100644
- --- a/PBGitRepository.m
- +++ b/PBGitRepository.m
- @@ -375,4 +375,9 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain";
- return nil;
- }
- +- (void) finalize
- +{
- + NSLog(@"Dealloc of repository");
- + [super finalize];
- +}
- @end
- diff --git a/PBGitWindowController.m b/PBGitWindowController.m
- index 7495b78..6cf01b5 100644
- --- a/PBGitWindowController.m
- +++ b/PBGitWindowController.m
- @@ -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];
- diff --git a/PBViewController.m b/PBViewController.m
- index 971eb36..38d9af1 100644
- --- a/PBViewController.m
- +++ b/PBViewController.m
- @@ -27,6 +27,7 @@
- - (void) removeView
- {
- + [self unbind:@"repository"];
- [[self view] removeFromSuperview]; // remove the current view
- }
- diff --git a/PBWebHistoryController.m b/PBWebHistoryController.m
- index e3f5575..1b49fa4 100644
- --- a/PBWebHistoryController.m
- +++ b/PBWebHistoryController.m
- @@ -108,4 +108,10 @@ contextMenuItemsForElement:(NSDictionary *)element
- return [historyController valueForKeyPath:[@"repository.config." stringByAppendingString:config]];
- }
- +- (void) finalize
- +{
- + [historyController removeObserver:self forKeyPath:@"webCommit"];
- + [super finalize];
- +}
- +
- @end
- --
- 1.6.0.3.875.g5bf73+GitX
Add Comment
Please, Sign In to add comment