Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(691)

Unified Diff: chrome/browser/ui/cocoa/infobars/infobar_controller.mm

Issue 7876004: [Mac] Break stale controller refs in infobar close. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Also fix target on the close button. Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/infobars/infobar_controller.mm
diff --git a/chrome/browser/ui/cocoa/infobars/infobar_controller.mm b/chrome/browser/ui/cocoa/infobars/infobar_controller.mm
index eabf4a9b88999512d904033c96bcb3a1c1ea5928..6e9e79f1eb87b0cf5a1b82ea45aef32f2f0848eb 100644
--- a/chrome/browser/ui/cocoa/infobars/infobar_controller.mm
+++ b/chrome/browser/ui/cocoa/infobars/infobar_controller.mm
@@ -78,6 +78,7 @@ const float kAnimateCloseDuration = 0.12;
labelFrame.size.width += NSMinX(imageFrame) - NSMinX(labelFrame);
labelFrame.origin.x = imageFrame.origin.x;
[image_ removeFromSuperview];
+ image_ = nil;
[labelPlaceholder_ setFrame:labelFrame];
}
[self initializeLabel];
@@ -88,6 +89,13 @@ const float kAnimateCloseDuration = 0.12;
[infoBarView_ setInfobarType:delegate_->GetInfoBarType()];
}
+- (void)dealloc {
+ [okButton_ setTarget:nil];
+ [cancelButton_ setTarget:nil];
+ [closeButton_ setTarget:nil];
+ [super dealloc];
+}
+
// Called when someone clicks on the embedded link.
- (BOOL) textView:(NSTextView*)textView
clickedOnLink:(id)link
@@ -176,7 +184,9 @@ const float kAnimateCloseDuration = 0.12;
NSRect labelFrame = [label_.get() frame];
labelFrame.size.width = NSMaxX([cancelButton_ frame]) - NSMinX(labelFrame);
[okButton_ removeFromSuperview];
+ okButton_ = nil;
[cancelButton_ removeFromSuperview];
+ cancelButton_ = nil;
[label_.get() setFrame:labelFrame];
}
@@ -359,6 +369,7 @@ const float kAnimateCloseDuration = 0.12;
rightEdge = NSMinX(okButtonFrame);
} else {
[okButton_ removeFromSuperview];
+ okButton_ = nil;
}
// Update and position the Cancel button if needed. Otherwise, hide it.
@@ -381,6 +392,7 @@ const float kAnimateCloseDuration = 0.12;
rightEdge = NSMinX(cancelButtonFrame);
} else {
[cancelButton_ removeFromSuperview];
+ cancelButton_ = nil;
}
// If we had either button, leave space before the edge of the textfield.

Powered by Google App Engine
This is Rietveld 408576698