Skip to content

Commit

Permalink
Delay automatic repo selection to give array controllers time to setup.
Browse files Browse the repository at this point in the history
Resolves #76.
  • Loading branch information
hjuutilainen committed Aug 7, 2015
1 parent 9605a93 commit 1551f97
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions MunkiAdmin/MAMunkiAdmin_AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -887,10 +887,19 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification

// Open previous repository
else if ([self.defaults integerForKey:@"startupWhatToDo"] == 2) {
NSURL *tempURL = [self.defaults URLForKey:@"selectedRepositoryPath"];
if (tempURL != nil) {
[self selectRepoAtURL:tempURL];
}

/*
Dirty hack to resolve "Cannot perform operation without a managed object context" exceptions.
Delay the repo selection by 0.5 seconds. I'm not proud of this...
TODO: Shouldn't need to delay repo selection on startup
*/
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
NSURL *tempURL = [self.defaults URLForKey:@"selectedRepositoryPath"];
if (tempURL != nil) {
[self selectRepoAtURL:tempURL];
}
});
}
// Do nothing
else if ([self.defaults integerForKey:@"startupWhatToDo"] == 0) {
Expand Down

0 comments on commit 1551f97

Please sign in to comment.