summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/views/controls/native_control_win.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/chrome/views/controls/native_control_win.cc b/chrome/views/controls/native_control_win.cc
index e8574f0..827f509 100644
--- a/chrome/views/controls/native_control_win.cc
+++ b/chrome/views/controls/native_control_win.cc
@@ -27,6 +27,14 @@ NativeControlWin::NativeControlWin() : HWNDView() {
}
NativeControlWin::~NativeControlWin() {
+ HWND hwnd = GetHWND();
+ if (hwnd) {
+ // Destroy the hwnd if it still exists. Otherwise we won't have shut things
+ // down correctly, leading to leaking and crashing if another message
+ // comes in for the hwnd.
+ Detach();
+ DestroyWindow(hwnd);
+ }
}
LRESULT NativeControlWin::ProcessMessage(UINT message, WPARAM w_param,