summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/gradient_button_cell.mm
diff options
context:
space:
mode:
authorshess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-21 21:02:32 +0000
committershess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-21 21:02:32 +0000
commit421dd05db9092a15df1a2c5c1011c588148078db (patch)
tree23106926ea2fee7f174d96991fa02cebdf87485e /chrome/browser/cocoa/gradient_button_cell.mm
parent00b73410b463dc2fd920ebc11d4e47ad24bdd42e (diff)
downloadchromium_src-421dd05db9092a15df1a2c5c1011c588148078db.zip
chromium_src-421dd05db9092a15df1a2c5c1011c588148078db.tar.gz
chromium_src-421dd05db9092a15df1a2c5c1011c588148078db.tar.bz2
[Mac] Tracking-area hygiene.
When tracking areas have an owner different from the view they are added to, they can exist past the owner's death. These have not been implicated in any crashes, but it's the best idea I have for the bug. BUG=38441 TEST=none Review URL: http://codereview.chromium.org/2823013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50387 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/gradient_button_cell.mm')
-rw-r--r--chrome/browser/cocoa/gradient_button_cell.mm9
1 files changed, 9 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/gradient_button_cell.mm b/chrome/browser/cocoa/gradient_button_cell.mm
index 15110e8..523b4d7 100644
--- a/chrome/browser/cocoa/gradient_button_cell.mm
+++ b/chrome/browser/cocoa/gradient_button_cell.mm
@@ -88,6 +88,14 @@ static const NSTimeInterval kAnimationHideDuration = 0.4;
return self;
}
+- (void)dealloc {
+ if (trackingArea_) {
+ [[self controlView] removeTrackingArea:trackingArea_];
+ trackingArea_.reset();
+ }
+ [super dealloc];
+}
+
- (NSGradient*)gradientForHoverAlpha:(CGFloat)hoverAlpha
isThemed:(BOOL)themed {
CGFloat startAlpha = 0.6 + 0.3 * hoverAlpha;
@@ -146,6 +154,7 @@ static const NSTimeInterval kAnimationHideDuration = 0.4;
if (showOnly) {
if (trackingArea_.get()) {
[self setShowsBorderOnlyWhileMouseInside:NO];
+ [[self controlView] removeTrackingArea:trackingArea_];
}
trackingArea_.reset([[NSTrackingArea alloc]
initWithRect:[[self controlView]