Stop a view that was not loaded from being loaded while being removed.

Example: If GitX started in stage view and the window was closed without ever looking at the history view, then [self view] will cause the history view's nib to be loaded which kicks off loading in the rev list. Wastes a lot of CPU cycles for no reason.
This commit is contained in:
Nathan Kinsinger
2010-06-20 14:38:16 -06:00
parent e4f6f960c7
commit 2c6a16a6a9
2 changed files with 6 additions and 3 deletions
+1
View File
@@ -16,6 +16,7 @@
NSString *status;
BOOL isBusy;
BOOL hasViewLoaded;
}
@property (readonly) __weak PBGitRepository *repository;
+5 -3
View File
@@ -27,14 +27,16 @@
return self;
}
- (void) removeView
- (void)removeView
{
[self unbind:@"repository"];
[[self view] removeFromSuperview]; // remove the current view
if (hasViewLoaded)
[[self view] removeFromSuperview]; // remove the current view
}
- (void) awakeFromNib
- (void)awakeFromNib
{
hasViewLoaded = YES;
}
- (NSResponder *)firstResponder;