diff options
author | jcivelli@chromium.org <jcivelli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-19 16:07:03 +0000 |
---|---|---|
committer | jcivelli@chromium.org <jcivelli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-19 16:07:03 +0000 |
commit | d0b683b69c926467468b4ca0b93d670317f7a2dc (patch) | |
tree | 08f5f8fc3cf6bc03b057311e496536a0584b5d9a /views | |
parent | 523623c62f291467769fbb3c0e7fd5c1709b4da1 (diff) | |
download | chromium_src-d0b683b69c926467468b4ca0b93d670317f7a2dc.zip chromium_src-d0b683b69c926467468b4ca0b93d670317f7a2dc.tar.gz chromium_src-d0b683b69c926467468b4ca0b93d670317f7a2dc.tar.bz2 |
A crasher would sometimes happen when opening a selet file dialog
(such as when loading an unpacled extension).
This is because we would reinterpret cast the user data of the HWND
to a WidgetWin, and in that case the Windows dialog has a user-data
that we did not set.
This CL checks that the HWND is at least a WindowImpl before attempting
to retrieve the WidgetWin, ensuring we won't mess with windows we did
not create directly.
BUG=44312
TEST=Open the extension page. Move the focus by pressing TAB to the
"Load unpacked extension..." button. Press ENTER many times quickly
so it opens/closes the "Select dir" dialog. It should not crash.
Review URL: http://codereview.chromium.org/2124009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47672 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/widget/widget_win.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/views/widget/widget_win.cc b/views/widget/widget_win.cc index c88e218..2b4c649 100644 --- a/views/widget/widget_win.cc +++ b/views/widget/widget_win.cc @@ -65,6 +65,11 @@ WidgetWin::~WidgetWin() { // static WidgetWin* WidgetWin::GetWidget(HWND hwnd) { + // TODO(jcivelli): http://crbug.com/44499 We need a way to test that hwnd is + // associated with a WidgetWin (it might be a pure + // WindowImpl). + if (!WindowImpl::IsWindowImpl(hwnd)) + return NULL; return reinterpret_cast<WidgetWin*>(win_util::GetWindowUserData(hwnd)); } |