Index: ui/gfx/win/window_impl.cc |
diff --git a/ui/gfx/win/window_impl.cc b/ui/gfx/win/window_impl.cc |
index 3ca3f900102feb7beb0788c1a5e0d4fbb65b1ee1..ff9fe57cf9dd8e5a2e21a6ea270c8c995e276084 100644 |
--- a/ui/gfx/win/window_impl.cc |
+++ b/ui/gfx/win/window_impl.cc |
@@ -226,10 +226,14 @@ HICON WindowImpl::GetDefaultWindowIcon() const { |
LRESULT WindowImpl::OnWndProc(UINT message, WPARAM w_param, LPARAM l_param) { |
LRESULT result = 0; |
+ HWND hwnd = hwnd_; |
+ if (message == WM_NCDESTROY) |
+ hwnd_ = NULL; |
+ |
// Handle the message if it's in our message map; otherwise, let the system |
// handle it. |
- if (!ProcessWindowMessage(hwnd_, message, w_param, l_param, result)) |
- result = DefWindowProc(hwnd_, message, w_param, l_param); |
+ if (!ProcessWindowMessage(hwnd, message, w_param, l_param, result)) |
+ result = DefWindowProc(hwnd, message, w_param, l_param); |
return result; |
} |