Skip to content

Commit bf83768

Browse files
committed
Workaround for ARC causing some of the view controllers to get released while not on the main thread.
1 parent 6e72e21 commit bf83768

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

PBGitRevList.mm

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,17 @@ - (void) walkRevisionListWithSpecifier:(PBGitRevSpecifier*)rev
238238

239239
[task terminate];
240240
[task waitUntilExit];
241+
242+
//Nasty hack to work around ARC and bindings getting angry at each other
243+
//Without this some of the view controllers can get released while not on the main thread, which crashes in bindings
244+
__block PBGitRepository *tempRepository = repository;
245+
246+
double delayInSeconds = 2.0;
247+
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
248+
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
249+
if ([tempRepository isKindOfClass:[PBGitRepository class]]) {
250+
}
251+
});
241252
}
242253

243254
@end

0 commit comments

Comments
 (0)