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

Unified Diff: chrome/browser/ui/browser.cc

Issue 666803002: Fix debug-only crash installing app from app launcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Added comment explaining why we don't close contents if there is no tab. Created 6 years, 2 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: chrome/browser/ui/browser.cc
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 1b5e6971449e871278e51567b65840270c236318..94037f2108fccf83730efa6831e9c7b56dd7ed58 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -1304,9 +1304,15 @@ void Browser::ShowDownload(content::DownloadItem* download) {
// If the download occurs in a new tab, and it's not a save page
// download (started before initial navigation completed) close it.
+ // Avoid calling CloseContents if the tab is not in this browser's tab strip
+ // model; this can happen if the download was initiated by something internal
+ // to Chrome, such as by the app list.
WebContents* source = download->GetWebContents();
if (source && source->GetController().IsInitialNavigation() &&
- tab_strip_model_->count() > 1 && !download->IsSavePackageDownload()) {
+ tab_strip_model_->count() > 1 &&
+ tab_strip_model_->GetIndexOfWebContents(source) !=
+ TabStripModel::kNoTab &&
+ !download->IsSavePackageDownload()) {
CloseContents(source);
}
« 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