| Index: chrome/browser/ui/cocoa/download/download_shelf_controller.mm
|
| diff --git a/chrome/browser/ui/cocoa/download/download_shelf_controller.mm b/chrome/browser/ui/cocoa/download/download_shelf_controller.mm
|
| index ebebb03f18c96560117ed7c28b07ca535c560912..fafbb78d8d59b9a92fa75c743133c378e3d56390 100644
|
| --- a/chrome/browser/ui/cocoa/download/download_shelf_controller.mm
|
| +++ b/chrome/browser/ui/cocoa/download/download_shelf_controller.mm
|
| @@ -142,13 +142,26 @@ const NSSize kHoverCloseButtonDefaultSize = { 18, 18 };
|
| }
|
|
|
| - (void)dealloc {
|
| + [self browserWillBeDestroyed];
|
| + [super dealloc];
|
| +}
|
| +
|
| +- (void)browserWillBeDestroyed {
|
| [[NSNotificationCenter defaultCenter] removeObserver:self];
|
| - [self cancelAutoClose];
|
| +
|
| + // We need to explicitly release our download controllers here since they need
|
| + // to remove themselves as observers before the remaining shutdown happens.
|
| + [[self animatableView] stopAnimation];
|
| [self removeTrackingArea];
|
| + [self cancelAutoClose];
|
| + while ([downloadItemControllers_ count] > 0) {
|
| + [self removeDownload:[downloadItemControllers_ lastObject]
|
| + isShelfClosing:YES];
|
| + }
|
| + downloadItemControllers_.reset();
|
|
|
| - // The controllers will unregister themselves as observers when they are
|
| - // deallocated. No need to do that here.
|
| - [super dealloc];
|
| + bridge_.reset();
|
| + navigator_ = nullptr;
|
| }
|
|
|
| // Called after the frame's rect has changed; usually when the height is
|
| @@ -213,19 +226,6 @@ const NSSize kHoverCloseButtonDefaultSize = { 18, 18 };
|
| [self maybeAutoCloseAfterDelay];
|
| }
|
|
|
| -// We need to explicitly release our download controllers here since they need
|
| -// to remove themselves as observers before the remaining shutdown happens.
|
| -- (void)exiting {
|
| - [[self animatableView] stopAnimation];
|
| - [self removeTrackingArea];
|
| - [self cancelAutoClose];
|
| - while ([downloadItemControllers_ count] > 0) {
|
| - [self removeDownload:[downloadItemControllers_ lastObject]
|
| - isShelfClosing:YES];
|
| - }
|
| - downloadItemControllers_.reset();
|
| -}
|
| -
|
| - (void)showDownloadShelf:(BOOL)show
|
| isUserAction:(BOOL)isUserAction {
|
| [self cancelAutoClose];
|
|
|