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

Unified Diff: chrome/browser/cocoa/tab_controller.mm

Issue 335048: [Mac] Prevent using tab context menu after tab closed. (Closed)
Patch Set: Also hit closeButton_. Created 11 years, 2 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/cocoa/tab_controller.mm
diff --git a/chrome/browser/cocoa/tab_controller.mm b/chrome/browser/cocoa/tab_controller.mm
index 94de7cfc1a72ee6f571fe8d58bdd72cd9d2ad280..0d05c5c0f0197ceb923de54878084d35c6616cb5 100644
--- a/chrome/browser/cocoa/tab_controller.mm
+++ b/chrome/browser/cocoa/tab_controller.mm
@@ -47,6 +47,17 @@
}
- (void)dealloc {
+ // Since the tab can be closed from JavaScript it is possible for
+ // |contextMenu_| to remain visible after the tab has closed, or for
+ // |closeButton_| to be tracking the mouse. Make sure neither sends
+ // us an action after -dealloc.
+ [closeButton_ setTarget:nil];
+ [contextMenu_ setAutoenablesItems:NO];
+ for (NSMenuItem* item in [contextMenu_ itemArray]) {
+ [item setTarget:nil];
+ [item setEnabled:NO];
+ }
+
[[NSNotificationCenter defaultCenter] removeObserver:self];
[super dealloc];
}
« 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