diff options
author | snej@chromium.org <snej@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-26 17:30:22 +0000 |
---|---|---|
committer | snej@chromium.org <snej@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-26 17:30:22 +0000 |
commit | 306a90d718ba3bf8d4a0f5f18ec30aa0e5c9432a (patch) | |
tree | 53a6a882348ccab808d8caa1f7108171501e19bd /chrome | |
parent | d7d587195e0008c8bfc40d7c2e6805730ecfdba4 (diff) | |
download | chromium_src-306a90d718ba3bf8d4a0f5f18ec30aa0e5c9432a.zip chromium_src-306a90d718ba3bf8d4a0f5f18ec30aa0e5c9432a.tar.gz chromium_src-306a90d718ba3bf8d4a0f5f18ec30aa0e5c9432a.tar.bz2 |
Fix for Mac tooltip crasher.
BUG=23397
TEST=none
Review URL: http://codereview.chromium.org/543200
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37110 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/cocoa/autocomplete_text_field.h | 3 | ||||
-rw-r--r-- | chrome/browser/cocoa/autocomplete_text_field.mm | 5 |
2 files changed, 8 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/autocomplete_text_field.h b/chrome/browser/cocoa/autocomplete_text_field.h index 1405cb5..0f29f1e 100644 --- a/chrome/browser/cocoa/autocomplete_text_field.h +++ b/chrome/browser/cocoa/autocomplete_text_field.h @@ -88,6 +88,9 @@ class AutocompleteTextFieldObserver { // Handles being a drag-and-drop target. scoped_nsobject<URLDropTargetHandler> dropHandler_; + + // Holds current tooltip strings, to keep them from being dealloced. + scoped_nsobject<NSMutableArray> currentToolTips_; } @property AutocompleteTextFieldObserver* observer; diff --git a/chrome/browser/cocoa/autocomplete_text_field.mm b/chrome/browser/cocoa/autocomplete_text_field.mm index 0697a92..6743461 100644 --- a/chrome/browser/cocoa/autocomplete_text_field.mm +++ b/chrome/browser/cocoa/autocomplete_text_field.mm @@ -26,6 +26,7 @@ - (void)awakeFromNib { DCHECK([[self cell] isKindOfClass:[AutocompleteTextFieldCell class]]); dropHandler_.reset([[URLDropTargetHandler alloc] initWithView:self]); + currentToolTips_.reset([[NSMutableArray alloc] init]); } - (void)flagsChanged:(NSEvent*)theEvent { @@ -222,6 +223,7 @@ // subviews. Unless more tooltips are added to this view, this should suffice // in place of managing a set of NSToolTipTag objects. [self removeAllToolTips]; + [currentToolTips_ removeAllObjects]; AutocompleteTextFieldCell* cell = [self autocompleteTextFieldCell]; const size_t pageActionCount = [cell pageActionCount]; @@ -231,6 +233,9 @@ if (!tooltip) continue; + // -[NSView addToolTipRect:owner:userData] does _not_ retain the owner! + // Put the string in a collection so it can't be dealloced while in use. + [currentToolTips_ addObject:tooltip]; [self addToolTipRect:iconRect owner:tooltip userData:nil]; } } |