Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(978)

Unified Diff: ui/views/win/hwnd_message_handler.cc

Issue 1636183003: Fix crash in the HWNDMessageHandler::HandleMouseInputForCaption function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added views_unittest DestroyInSysCommandNCLButtonDownOnCaption, which verifies that we don't crash … Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« ui/views/widget/widget_unittest.cc ('K') | « ui/views/widget/widget_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/win/hwnd_message_handler.cc
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc
index 0cacffe4a76dfdde167943bf1f232f87736b9a76..d16836227e7f3f15a3b40182b4f3239f8b415c6c 100644
--- a/ui/views/win/hwnd_message_handler.cc
+++ b/ui/views/win/hwnd_message_handler.cc
@@ -2557,12 +2557,15 @@ bool HWNDMessageHandler::HandleMouseInputForCaption(unsigned int message,
// so we need to call it inside a ScopedRedrawLock. This may cause
// other negative side-effects
// (ex/ stifling non-client mouse releases).
+ // We may be deleted in the context of DefWindowProc. Don't refer to
+ // any member variables after the DefWindowProc call.
+ left_button_down_on_caption_ = false;
+
if (delegate_->IsUsingCustomFrame()) {
DefWindowProcWithRedrawLock(WM_NCLBUTTONDOWN, HTCAPTION, l_param);
} else {
DefWindowProc(hwnd(), WM_NCLBUTTONDOWN, HTCAPTION, l_param);
}
- left_button_down_on_caption_ = false;
}
break;
}
« ui/views/widget/widget_unittest.cc ('K') | « ui/views/widget/widget_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698