Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Unified Diff: chrome/browser/app_controller_mac.mm

Issue 546106: Ensure method to set up cmd-w/cmd-shift-w runs on the main thread, add a DCHE... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698