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

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

Issue 296993004: Fixes use after free in HWNDMessageHandler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
« no previous file with comments | « no previous file | 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.h
diff --git a/ui/views/win/hwnd_message_handler.h b/ui/views/win/hwnd_message_handler.h
index 24cd8fda66d53212e1cfbabe45a1a21ee0c17c0b..d5a5c866c9ae5f56c43d83ad3fc6b893fbf731a5 100644
--- a/ui/views/win/hwnd_message_handler.h
+++ b/ui/views/win/hwnd_message_handler.h
@@ -78,10 +78,12 @@ const int WM_NCUAHDRAWFRAME = 0xAF;
LPARAM l_param, \
LRESULT& l_result, \
DWORD msg_map_id = 0) { \
+ base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr()); \
BOOL old_msg_handled = msg_handled_; \
BOOL ret = _ProcessWindowMessage(hwnd, msg, w_param, l_param, l_result, \
msg_map_id); \
- msg_handled_ = old_msg_handled; \
+ if (ref.get()) \
+ msg_handled_ = old_msg_handled; \
return ret; \
} \
BOOL _ProcessWindowMessage(HWND hWnd, \
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698