diff options
author | gspencer@chromium.org <gspencer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-25 17:51:01 +0000 |
---|---|---|
committer | gspencer@chromium.org <gspencer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-25 17:51:01 +0000 |
commit | aec735145db220b5f8945b8a9780ef97c7d63702 (patch) | |
tree | 08ebfcdb026ef03c1cb9d438855f0998d27c3387 /chrome/browser/chromeos | |
parent | bc2ae1092ead4f182a8d0642a5975b7663367139 (diff) | |
download | chromium_src-aec735145db220b5f8945b8a9780ef97c7d63702.zip chromium_src-aec735145db220b5f8945b8a9780ef97c7d63702.tar.gz chromium_src-aec735145db220b5f8945b8a9780ef97c7d63702.tar.bz2 |
Merge 143327 - gdata: Fix a crash in GDataUploader::UploadFailed()
Yet another crash caused by misuse of scoped_ptr<>::Pass()...
BUG=133877
TEST=Make uploading to Drive fail, and conform Chrome does not crash
Review URL: https://chromiumcodereview.appspot.com/10608003
TBR=satorux@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10661032
git-svn-id: svn://svn.chromium.org/chrome/branches/1180/src@143944 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos')
-rw-r--r-- | chrome/browser/chromeos/gdata/gdata_uploader.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/chrome/browser/chromeos/gdata/gdata_uploader.cc b/chrome/browser/chromeos/gdata/gdata_uploader.cc index c2be139..b0bffd1 100644 --- a/chrome/browser/chromeos/gdata/gdata_uploader.cc +++ b/chrome/browser/chromeos/gdata/gdata_uploader.cc @@ -386,10 +386,12 @@ void GDataUploader::UploadFailed(scoped_ptr<UploadFileInfo> upload_file_info, RemoveUpload(upload_file_info->upload_id); LOG(ERROR) << "Upload failed " << upload_file_info->DebugString(); - if (!upload_file_info->completion_callback.is_null()) { - upload_file_info->completion_callback.Run(error, - upload_file_info.Pass()); - } + // This is subtle but we should take the callback reference before + // calling upload_file_info.Pass(). Otherwise, it'll crash. + const UploadFileInfo::UploadCompletionCallback& callback = + upload_file_info->completion_callback; + if (!callback.is_null()) + callback.Run(error, upload_file_info.Pass()); } void GDataUploader::RemoveUpload(int upload_id) { |