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

Unified Diff: content/shell/browser/shell_mac.mm

Issue 2872903004: [Mac] Nil out content shell window delegate on close (Closed)
Patch Set: Comment Created 3 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/browser/shell_mac.mm
diff --git a/content/shell/browser/shell_mac.mm b/content/shell/browser/shell_mac.mm
index fc972c4c441b8ac1380b88d2347c363e696f34ac..797b7dd89af5ae161dc4b8c6cff6c1d8c350c1d5 100644
--- a/content/shell/browser/shell_mac.mm
+++ b/content/shell/browser/shell_mac.mm
@@ -7,6 +7,7 @@
#include <algorithm>
#include "base/logging.h"
+#import "base/mac/foundation_util.h"
#import "base/mac/scoped_nsobject.h"
#include "base/mac/sdk_forward_declarations.h"
#include "base/strings/string_piece.h"
@@ -39,8 +40,12 @@
// sequence by getting rid of the shell and removing it and the window from
// the various global lists. By returning YES, we allow the window to be
// removed from the screen.
-- (BOOL)windowShouldClose:(id)window {
+- (BOOL)windowShouldClose:(id)sender {
+ NSWindow* window = base::mac::ObjCCastStrict<NSWindow>(sender);
[window autorelease];
+ // Don't leave a dangling pointer if the window lives beyond
+ // this method. See crbug.com/719830.
+ [window setDelegate:nil];
delete shell_;
[self release];
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698