Skip to content

Commit

Permalink
MD-71
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.code.sf.net/p/osirix/code/osirix@10852 4e9e6e3d-4551-47eb-9dbe-a6127f9400a1
  • Loading branch information
rossetantoine committed Jan 22, 2013
1 parent d7c016f commit e555a46
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
11 changes: 9 additions & 2 deletions ThreadModalForWindowController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,11 @@ -(void)observeValueForKeyPath:(NSString*)keyPath ofObject:(NSThread*)obj change:
-(void)invalidate {
DLog(@"[ThreadModalForWindowController invalidate]");
[[NSNotificationCenter defaultCenter] removeObserver:self name:NSThreadWillExitNotification object:_thread];
[self.thread.threadDictionary removeObjectForKey:NSThreadModalForWindowControllerKey];

@synchronized( self.thread.threadDictionary)
{
[self.thread.threadDictionary removeObjectForKey:NSThreadModalForWindowControllerKey];
}

_isValid = NO;

Expand Down Expand Up @@ -297,7 +301,10 @@ -(ThreadModalForWindowController*)startModalForWindow:(NSWindow*)window {
}

-(ThreadModalForWindowController*)modalForWindowController {
return [self.threadDictionary objectForKey:NSThreadModalForWindowControllerKey];
@synchronized( self.threadDictionary)
{
return [self.threadDictionary objectForKey:NSThreadModalForWindowControllerKey];
}
}

@end
Expand Down
5 changes: 4 additions & 1 deletion ViewerController.m
Original file line number Diff line number Diff line change
Expand Up @@ -8023,7 +8023,10 @@ + (void) loadImageData:(id) dict
return;
}

[[NSThread currentThread].threadDictionary setObject: [NSNumber numberWithFloat: 1.0] forKey: @"loadingPercentage"];
@synchronized( [NSThread currentThread])
{
[[NSThread currentThread].threadDictionary setObject: [NSNumber numberWithFloat: 1.0] forKey: @"loadingPercentage"];
}
}
@catch (NSException * e)
{
Expand Down

0 comments on commit e555a46

Please sign in to comment.