diff options
author | finnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-16 23:15:34 +0000 |
---|---|---|
committer | finnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-16 23:15:34 +0000 |
commit | df17fc7f79dbce8f86f612193c8d305df8f500d3 (patch) | |
tree | 20830fa155e2e167c6352ac103a4c33fc16d34d7 /chrome/browser/views | |
parent | 2cd0c137dacb2429839741295ab4a9ff2940f968 (diff) | |
download | chromium_src-df17fc7f79dbce8f86f612193c8d305df8f500d3.zip chromium_src-df17fc7f79dbce8f86f612193c8d305df8f500d3.tar.gz chromium_src-df17fc7f79dbce8f86f612193c8d305df8f500d3.tar.bz2 |
Fix crash in downloading files (issue 3423).
I was finally able to reproduce a problem where we would crash when
clicking Save on the Download Tab (it would also crash during animation
of the items on the download shelf after switching away from the tab
downloading).
The reason for the crash is that if the controls on the download shelf
have not been laid out once (before switching to a tab that doesn't have
a download shelf), then we'll crash inside NativeControlContainer ctor
when it tries to ValidateNativeControl() (it walks up the parent
hierarchy trying to find the ViewContainer and ends up dereferencing a
NULL pointer).
This was reviewed by jcampan as http://codereview.chromium.org/7446
I had to recreate the changelist before submitting (long story).
Review URL: http://codereview.chromium.org/7604
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3492 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r-- | chrome/browser/views/download_shelf_view.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/chrome/browser/views/download_shelf_view.cc b/chrome/browser/views/download_shelf_view.cc index ed6b074..d2ea863 100644 --- a/chrome/browser/views/download_shelf_view.cc +++ b/chrome/browser/views/download_shelf_view.cc @@ -199,6 +199,15 @@ void DownloadShelfView::AnimationEnded(const Animation *animation) { } void DownloadShelfView::Layout() { + // When the download shelf is not visible it is not parented to anything, + // which means it is not safe to lay out the controls, so we return early. + // Otherwise, we can have problems when for example the user switches to + // another tab (that doesn't have a download shelf) _before_ the download + // has started and we'll crash when calling SetVisible() below because + // the NativeControlContainer ctor tries to use the ViewContainer. + if (!GetViewContainer()) + return; + gfx::Size image_size = arrow_image_->GetPreferredSize(); gfx::Size close_button_size = close_button_->GetPreferredSize(); gfx::Size show_all_size = show_all_view_->GetPreferredSize(); |