Chromium Code Reviews| Index: chrome/browser/app_controller_mac.mm |
| =================================================================== |
| --- chrome/browser/app_controller_mac.mm (revision 36749) |
| +++ chrome/browser/app_controller_mac.mm (working copy) |
| @@ -273,17 +273,19 @@ |
| // Fix up the "close tab/close window" command-key equivalents. We do this |
| // after a delay to ensure that window layer state has been set by the time |
| -// we do the enabling. |
| +// we do the enabling. This should only be called on the main thread, code that |
| +// calls this (even as a side-effect) from other threads needs to be fixed. |
| - (void)delayedFixCloseMenuItemKeyEquivalents { |
| + DCHECK([NSThread currentThread] == [NSThread mainThread]); |
|
TVL
2010/01/21 16:03:33
why not just [NSThread isMainThread]?
|
| if (!fileMenuUpdatePending_) { |
| // The OS prefers keypresses to timers, so it's possible that a cmd-w |
| // can sneak in before this timer fires. In order to prevent that from |
| // having any bad consequences, just clear the keys combos altogether. They |
| // will be reset when the timer eventually fires. |
| [self clearCloseMenuItemKeyEquivalents]; |
| - [self performSelector:@selector(fixCloseMenuItemKeyEquivalents) |
| - withObject:nil |
| - afterDelay:0]; |
| + [self performSelectorOnMainThread:@selector(fixCloseMenuItemKeyEquivalents) |
| + withObject:nil |
| + waitUntilDone:NO]; |
| fileMenuUpdatePending_ = YES; |
| } |
| } |