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

Unified Diff: chrome/browser/views/download_item_view.cc

Issue 3023052: Merging r55430 to the M6 branch:... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/472/src/
Patch Set: Created 10 years, 4 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 | « chrome/browser/views/download_item_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/download_item_view.cc
===================================================================
--- chrome/browser/views/download_item_view.cc (revision 55436)
+++ chrome/browser/views/download_item_view.cc (working copy)
@@ -132,7 +132,8 @@
dangerous_download_label_sized_(false),
disabled_while_opening_(false),
creation_time_(base::Time::Now()),
- ALLOW_THIS_IN_INITIALIZER_LIST(reenable_method_factory_(this)) {
+ ALLOW_THIS_IN_INITIALIZER_LIST(reenable_method_factory_(this)),
+ deleted_(NULL) {
DCHECK(download_);
download_->AddObserver(this);
@@ -311,6 +312,8 @@
icon_consumer_.CancelAllRequests();
StopDownloadProgress();
download_->RemoveObserver(this);
+ if (deleted_)
+ *deleted_ = true;
}
// Progress animation handlers.
@@ -819,7 +822,14 @@
if (!context_menu_.get())
context_menu_.reset(new DownloadShelfContextMenuWin(model_.get()));
+ // When we call the Run method on the menu, it runs an inner message loop
+ // that might causes us to be deleted.
+ bool deleted = false;
+ deleted_ = &deleted;
context_menu_->Run(point);
+ if (deleted)
+ return true; // We have been deleted! Don't access 'this'.
+ deleted_ = NULL;
// If the menu action was to remove the download, this view will also be
// invalid so we must not access 'this' in this case.
« no previous file with comments | « chrome/browser/views/download_item_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698