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

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_controller.mm

Issue 2041213002: Address a crash under -[NSWindow close] via a WeakPtr PostTask from Browser::TabStripEmpty() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: windowWillClose Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_cocoa.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 5 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <numeric> 8 #include <numeric>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 afterDelay:0]; 523 afterDelay:0];
524 } 524 }
525 525
526 // Called when the window meets the criteria to be closed (ie, 526 // Called when the window meets the criteria to be closed (ie,
527 // |-windowShouldClose:| returns YES). We must be careful to preserve the 527 // |-windowShouldClose:| returns YES). We must be careful to preserve the
528 // semantics of BrowserWindow::Close() and not call the Browser's dtor directly 528 // semantics of BrowserWindow::Close() and not call the Browser's dtor directly
529 // from this method. 529 // from this method.
530 - (void)windowWillClose:(NSNotification*)notification { 530 - (void)windowWillClose:(NSNotification*)notification {
531 DCHECK_EQ([notification object], [self window]); 531 DCHECK_EQ([notification object], [self window]);
532 DCHECK(browser_->tab_strip_model()->empty()); 532 DCHECK(browser_->tab_strip_model()->empty());
533 windowShim_->OnWindowWillClose();
533 [savedRegularWindow_ close]; 534 [savedRegularWindow_ close];
534 // We delete statusBubble here because we need to kill off the dependency 535 // We delete statusBubble here because we need to kill off the dependency
535 // that its window has on our window before our window goes away. 536 // that its window has on our window before our window goes away.
536 delete statusBubble_; 537 delete statusBubble_;
537 statusBubble_ = NULL; 538 statusBubble_ = NULL;
538 // We can't actually use |-autorelease| here because there's an embedded 539 // We can't actually use |-autorelease| here because there's an embedded
539 // run loop in the |-performClose:| which contains its own autorelease pool. 540 // run loop in the |-performClose:| which contains its own autorelease pool.
540 // Instead call it after a zero-length delay, which gets us back to the main 541 // Instead call it after a zero-length delay, which gets us back to the main
541 // event loop. 542 // event loop.
542 [self performSelector:@selector(autorelease) 543 [self performSelector:@selector(autorelease)
(...skipping 1513 matching lines...) Expand 10 before | Expand all | Expand 10 after
2056 2057
2057 - (BOOL)isTabbedWindow { 2058 - (BOOL)isTabbedWindow {
2058 return browser_->is_type_tabbed(); 2059 return browser_->is_type_tabbed();
2059 } 2060 }
2060 2061
2061 - (NSRect)savedRegularWindowFrame { 2062 - (NSRect)savedRegularWindowFrame {
2062 return savedRegularWindowFrame_; 2063 return savedRegularWindowFrame_;
2063 } 2064 }
2064 2065
2065 @end // @implementation BrowserWindowController(WindowType) 2066 @end // @implementation BrowserWindowController(WindowType)
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_cocoa.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698