summaryrefslogtreecommitdiffstats
path: root/chrome/views/widget_win.cc
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-03 06:10:00 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-03 06:10:00 +0000
commit6d03fd1d5f678c0aa12668aad69156d448ed92c3 (patch)
treef55e2e37152cbc9ae65b34ece8fadfbd692ad0fb /chrome/views/widget_win.cc
parentabfad64fbef99f056908a664bc3dc6c97dce74d6 (diff)
downloadchromium_src-6d03fd1d5f678c0aa12668aad69156d448ed92c3.zip
chromium_src-6d03fd1d5f678c0aa12668aad69156d448ed92c3.tar.gz
chromium_src-6d03fd1d5f678c0aa12668aad69156d448ed92c3.tar.bz2
RootView should be destroyed in WM_NCDESTROY not after it.
Review URL: http://codereview.chromium.org/12632 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6277 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views/widget_win.cc')
-rw-r--r--chrome/views/widget_win.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/chrome/views/widget_win.cc b/chrome/views/widget_win.cc
index cd0e913..2707894 100644
--- a/chrome/views/widget_win.cc
+++ b/chrome/views/widget_win.cc
@@ -132,7 +132,6 @@ WidgetWin::WidgetWin()
}
WidgetWin::~WidgetWin() {
- MessageLoopForUI::current()->RemoveObserver(this);
}
void WidgetWin::Init(HWND parent, const gfx::Rect& bounds,
@@ -550,6 +549,16 @@ LRESULT WidgetWin::OnMouseRange(UINT msg, WPARAM w_param, LPARAM l_param) {
return 0;
}
+void WidgetWin::OnNCDestroy() {
+ // Destroy the view hierarchy here as the window is destroyed, _before_ the
+ // Widget is destroyed and before our associated focus manager is destroyed.
+ // Views in the view hierarchy may attempt to manipulate the focus manager or
+ // other aspects of the window in ways that are not compatible with the fact
+ // that it has just been destroyed.
+ MessageLoopForUI::current()->RemoveObserver(this);
+ root_view_.reset(NULL);
+}
+
void WidgetWin::OnNCLButtonDblClk(UINT flags, const CPoint& point) {
SetMsgHandled(FALSE);
}