From 394337cffb08b083513f3f93c7137aea788af5fa Mon Sep 17 00:00:00 2001 From: "ananta@chromium.org" Date: Tue, 2 Mar 2010 18:29:01 +0000 Subject: Fix a Chrome crash, which occurs in a ChromeFrame instance in the destructor of the WidgetWin object for the ExternalTabContainer. Basically the crash happens while dereferencing the chrome ui message loop which has been destroyed. This could happen in a ChromeFrame instance as the message loop is destroyed when the module ref count drops to 0. The ref count is decremented in the destructor of the AutomationProvider which runs before the Widgetwin destructor. Fix is to move the code in the WidgetWin destructor to the code which processes WM_NCDESTROY Fixes bug http://code.google.com/p/chromium/issues/detail?id=37163 Bug=37163 Review URL: http://codereview.chromium.org/663001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40393 0039d316-1c4b-4281-b951-d872f2087c98 --- views/widget/widget_win.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'views') diff --git a/views/widget/widget_win.cc b/views/widget/widget_win.cc index 8a97b34..5fb5cf8 100644 --- a/views/widget/widget_win.cc +++ b/views/widget/widget_win.cc @@ -59,7 +59,6 @@ WidgetWin::WidgetWin() } WidgetWin::~WidgetWin() { - MessageLoopForUI::current()->RemoveObserver(this); } // static @@ -1180,8 +1179,10 @@ LRESULT WidgetWin::OnWndProc(UINT message, WPARAM w_param, LPARAM l_param) { // Otherwise we handle everything else. if (!ProcessWindowMessage(window, message, w_param, l_param, result)) result = DefWindowProc(window, message, w_param, l_param); - if (message == WM_NCDESTROY) + if (message == WM_NCDESTROY) { + MessageLoopForUI::current()->RemoveObserver(this); OnFinalMessage(window); + } if (message == WM_ACTIVATE) PostProcessActivateMessage(this, LOWORD(w_param)); if (message == WM_ENABLE && restore_focus_when_enabled_) { -- cgit v1.1