diff options
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]; } } |