summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/delayedmenu_button.mm
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-13 20:47:47 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-13 20:47:47 +0000
commit8ef755bf7d6f10b307c1a92f6c3b1c7944cf06aa (patch)
tree04e4ddf6f48d96110fe4f05cf48b9f5eba3dc789 /chrome/browser/cocoa/delayedmenu_button.mm
parentc56cb410c3903f08d7cc0ed1589d6dcee433b624 (diff)
downloadchromium_src-8ef755bf7d6f10b307c1a92f6c3b1c7944cf06aa.zip
chromium_src-8ef755bf7d6f10b307c1a92f6c3b1c7944cf06aa.tar.gz
chromium_src-8ef755bf7d6f10b307c1a92f6c3b1c7944cf06aa.tar.bz2
Fix crash caused by having accessibility turned on.
BUG=http://crbug.com/31007 TEST=as in bug Review URL: http://codereview.chromium.org/548015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36164 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/delayedmenu_button.mm')
-rw-r--r--chrome/browser/cocoa/delayedmenu_button.mm22
1 files changed, 13 insertions, 9 deletions
diff --git a/chrome/browser/cocoa/delayedmenu_button.mm b/chrome/browser/cocoa/delayedmenu_button.mm
index 7243285..dbbde4a 100644
--- a/chrome/browser/cocoa/delayedmenu_button.mm
+++ b/chrome/browser/cocoa/delayedmenu_button.mm
@@ -118,16 +118,20 @@
// However, using a pulldown has the benefit that Cocoa automatically places
// the menu correctly even when we're at the edge of the screen (including
// "dragging upwards" when the button is close to the bottom of the screen).
- scoped_nsobject<NSPopUpButtonCell> popUpCell(
- [[NSPopUpButtonCell alloc] initTextCell:@""
- pullsDown:YES]);
- DCHECK(popUpCell.get());
- [popUpCell setMenu:attachedMenu_];
- [popUpCell selectItem:nil];
- [popUpCell attachPopUpWithFrame:frame
- inView:self];
- [popUpCell performClickWithFrame:frame
+ // A |scoped_nsobject| local variable cannot be used here because
+ // Accessibility on 10.5 grabs the NSPopUpButtonCell without retaining it, and
+ // uses it later. (This is fixed in 10.6.)
+ if (!popUpCell_.get()) {
+ popUpCell_.reset([[NSPopUpButtonCell alloc] initTextCell:@""
+ pullsDown:YES]);
+ }
+ DCHECK(popUpCell_.get());
+ [popUpCell_ setMenu:attachedMenu_];
+ [popUpCell_ selectItem:nil];
+ [popUpCell_ attachPopUpWithFrame:frame
inView:self];
+ [popUpCell_ performClickWithFrame:frame
+ inView:self];
}
@end // @implementation DelayedMenuButton (Private)