From 89d49f114cff9ecd0fabd6a108f3972fb0ab9027 Mon Sep 17 00:00:00 2001
From: "thakis@chromium.org"
 <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Wed, 29 Dec 2010 18:21:29 +0000
Subject: [PATCH] Mac: Try to fix a crash related to save panels.

All the stacks are always in the destructors. Wild guess: Maybe NSSavePanel takes the context object from the delegate instead of self. Pass in the delegate as described by the docs.

BUG=58959
TEST=maybe fewer crashes on the crash server

Review URL: http://codereview.chromium.org/6031008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70265 0039d316-1c4b-4281-b951-d872f2087c98
---
 chrome/browser/ui/cocoa/shell_dialogs_mac.mm | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/chrome/browser/ui/cocoa/shell_dialogs_mac.mm b/chrome/browser/ui/cocoa/shell_dialogs_mac.mm
index 257bb628aa0e9..92b2f589f183b 100644
--- a/chrome/browser/ui/cocoa/shell_dialogs_mac.mm
+++ b/chrome/browser/ui/cocoa/shell_dialogs_mac.mm
@@ -36,7 +36,7 @@ class SelectFileDialogImpl;
 - (id)initWithSelectFileDialogImpl:(SelectFileDialogImpl*)s;
 - (void)endedPanel:(NSSavePanel*)panel
         withReturn:(int)returnCode
-           context:(void *)context;
+           context:(void*)context;
 
 // NSSavePanel delegate method
 - (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename;
@@ -126,7 +126,7 @@ SelectFileDialogImpl::~SelectFileDialogImpl() {
 
   for (std::vector<NSSavePanel*>::iterator it = panels.begin();
        it != panels.end(); ++it) {
-    [(*it) cancel:nil];
+    [*it cancel:*it];
   }
 }
 
@@ -216,8 +216,8 @@ void SelectFileDialogImpl::SelectFile(
   SheetContext* context = new SheetContext;
 
   // |context| should never be NULL, but we are seeing indications otherwise.
-  // |This CHECK is here to confirm if we are actually getting NULL
-  // ||context|s. http://crbug.com/58959
+  // This CHECK is here to confirm if we are actually getting NULL
+  // |context|s. http://crbug.com/58959
   CHECK(context);
   context->type = type;
   context->owning_window = owning_window;
@@ -361,7 +361,7 @@ bool SelectFileDialogImpl::ShouldEnableFilename(NSSavePanel* dialog,
 
 - (void)endedPanel:(NSSavePanel*)panel
         withReturn:(int)returnCode
-           context:(void *)context {
+           context:(void*)context {
   // |context| should never be NULL, but we are seeing indications otherwise.
   // |This CHECK is here to confirm if we are actually getting NULL
   // ||context|s. http://crbug.com/58959
-- 
GitLab