Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix memory leaks

  • Loading branch information...
commit 3dd63854404b31cdf3a2b2d1ce3f18507af9664f 1 parent 2bab86c
@pieter authored
View
5 PBGitCommitController.m
@@ -30,6 +30,11 @@ - (void)awakeFromNib
[cachedFilesController setSortDescriptors:[NSArray arrayWithObject:
[[NSSortDescriptor alloc] initWithKey:@"path" ascending:true]]];
}
+- (void) removeView
+{
+ [webController closeView];
+ [super finalize];
+}
- (void) setAmend:(BOOL)newAmend
{
View
4 PBGitHistoryController.m
@@ -190,6 +190,10 @@ - (BOOL) hasNonlinearPath
- (void) removeView
{
[webView close];
+ [commitController removeObserver:self forKeyPath:@"selection"];
+ [treeController removeObserver:self forKeyPath:@"selection"];
+ [repository removeObserver:self forKeyPath:@"currentBranch"];
+
[super removeView];
}
View
5 PBGitRepository.m
@@ -375,4 +375,9 @@ - (NSString*) parseSymbolicReference:(NSString*) reference
return nil;
}
+- (void) finalize
+{
+ NSLog(@"Dealloc of repository");
+ [super finalize];
+}
@end
View
6 PBGitWindowController.m
@@ -33,6 +33,11 @@ - (id)initWithRepository:(PBGitRepository*)theRepository displayDefault:(BOOL)di
return self;
}
+- (void)windowWillClose:(NSNotification *)notification
+{
+ [viewController removeView];
+}
+
- (void) setSelectedViewIndex: (int) i
{
selectedViewIndex = i;
@@ -70,6 +75,7 @@ - (void)changeViewController:(NSInteger)whichViewTag
- (void)awakeFromNib
{
+ [[self window] setDelegate:self];
[[self window] setAutorecalculatesContentBorderThickness:NO forEdge:NSMinYEdge];
[[self window] setContentBorderThickness:35.0f forEdge:NSMinYEdge];
[self showHistoryView:nil];
View
1  PBViewController.m
@@ -27,6 +27,7 @@ - (id)initWithRepository:(PBGitRepository *)theRepository superController:(PBGit
- (void) removeView
{
+ [self unbind:@"repository"];
[[self view] removeFromSuperview]; // remove the current view
}
View
1  PBWebController.h
@@ -25,4 +25,5 @@
@property (retain) id repository;
- (WebScriptObject *) script;
+- (void) closeView;
@end
View
6 PBWebController.m
@@ -35,6 +35,12 @@ - (WebScriptObject *) script
return [view windowScriptObject];
}
+- (void) closeView
+{
+ if (view)
+ [view close];
+}
+
# pragma mark Delegate methods
- (void) webView:(id) v didFinishLoadForFrame:(id) frame
View
6 PBWebHistoryController.m
@@ -108,4 +108,10 @@ - (void)webView:(WebView *)sender decidePolicyForNewWindowAction:(NSDictionary
return [historyController valueForKeyPath:[@"repository.config." stringByAppendingString:config]];
}
+- (void) finalize
+{
+ [historyController removeObserver:self forKeyPath:@"webCommit"];
+ [super finalize];
+}
+
@end
Please sign in to comment.
Something went wrong with that request. Please try again.