Skip to content

Commit

Permalink
Fixes (hopefully) crashes when downloading an item due to attempting to
Browse files Browse the repository at this point in the history
use BraveDownloadItemView after it is deleted by the base class on
download completion.

Fixes brave/brave-browser#1628
  • Loading branch information
mkarolin committed Oct 17, 2018
1 parent dbba50b commit 273f276
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion browser/ui/views/download/brave_download_item_view.cc
Original file line number Diff line number Diff line change
@@ -81,7 +81,9 @@ void BraveDownloadItemView::OnDownloadUpdated(
download::DownloadItem* download) {
// Check for conditions that would disregard origin url change and fall back
// onto base implementation to handle them.
if (!model_.ShouldShowInShelf()) {
if (!model_.ShouldShowInShelf() ||
(DownloadItemView::download()->GetState() == DownloadItem::COMPLETE &&
model_.ShouldRemoveFromShelfWhenComplete())) {
DownloadItemView::OnDownloadUpdated(download);
return;
}

0 comments on commit 273f276

Please sign in to comment.