summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-30 18:38:15 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-30 18:38:15 +0000
commitdd5d083044c0a65f9756d03425ea81a6f34dcc3c (patch)
tree25b2171d594c8ed7ae1a3208e2337524068e1c32 /chrome/browser/cocoa
parentc57d648c0a08740668a72c4f9ec541bfc501b6d8 (diff)
downloadchromium_src-dd5d083044c0a65f9756d03425ea81a6f34dcc3c.zip
chromium_src-dd5d083044c0a65f9756d03425ea81a6f34dcc3c.tar.gz
chromium_src-dd5d083044c0a65f9756d03425ea81a6f34dcc3c.tar.bz2
Fix contextual menu crash by disabling the contextual menu.
BUG=http://crbug.com/42743 TEST=as in bug Review URL: http://codereview.chromium.org/1687025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46099 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa')
-rw-r--r--chrome/browser/cocoa/tab_view.mm21
1 files changed, 11 insertions, 10 deletions
diff --git a/chrome/browser/cocoa/tab_view.mm b/chrome/browser/cocoa/tab_view.mm
index 7507166..811e3d6 100644
--- a/chrome/browser/cocoa/tab_view.mm
+++ b/chrome/browser/cocoa/tab_view.mm
@@ -75,9 +75,18 @@ const CGFloat kRapidCloseDist = 2.5;
[super dealloc];
}
-// Use the TabController to provide the menu rather than obtaining it from the
-// nib file.
+// Called to obtain the context menu for when the user hits the right mouse
+// button (or control-clicks). (Note that -rightMouseDown: is *not* called for
+// control-click.)
- (NSMenu*)menu {
+ if ([self isClosing])
+ return nil;
+
+ // Sheets, being window-modal, should block contextual menus. For some reason
+ // they do not. Disallow them ourselves.
+ if ([[self window] attachedSheet])
+ return nil;
+
return [controller_ menu];
}
@@ -768,14 +777,6 @@ const CGFloat kRapidCloseDist = 2.5;
[context restoreGraphicsState];
}
-// Called when the user hits the right mouse button (or control-clicks) to
-// show a context menu.
-- (void)rightMouseDown:(NSEvent*)theEvent {
- if ([self isClosing])
- return;
- [NSMenu popUpContextMenu:[self menu] withEvent:theEvent forView:self];
-}
-
- (void)viewDidMoveToWindow {
[super viewDidMoveToWindow];
if ([self window]) {