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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_ 5 #ifndef UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_
6 #define UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_ 6 #define UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_
7 7
8 #include <windows.h> 8 #include <windows.h>
9 9
10 #include <set> 10 #include <set>
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 /* "handled" management for cracked handlers */ \ 71 /* "handled" management for cracked handlers */ \
72 void SetMsgHandled(BOOL handled) { \ 72 void SetMsgHandled(BOOL handled) { \
73 msg_handled_ = handled; \ 73 msg_handled_ = handled; \
74 } \ 74 } \
75 BOOL ProcessWindowMessage(HWND hwnd, \ 75 BOOL ProcessWindowMessage(HWND hwnd, \
76 UINT msg, \ 76 UINT msg, \
77 WPARAM w_param, \ 77 WPARAM w_param, \
78 LPARAM l_param, \ 78 LPARAM l_param, \
79 LRESULT& l_result, \ 79 LRESULT& l_result, \
80 DWORD msg_map_id = 0) { \ 80 DWORD msg_map_id = 0) { \
81 base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr()); \
81 BOOL old_msg_handled = msg_handled_; \ 82 BOOL old_msg_handled = msg_handled_; \
82 BOOL ret = _ProcessWindowMessage(hwnd, msg, w_param, l_param, l_result, \ 83 BOOL ret = _ProcessWindowMessage(hwnd, msg, w_param, l_param, l_result, \
83 msg_map_id); \ 84 msg_map_id); \
84 msg_handled_ = old_msg_handled; \ 85 if (ref.get()) \
86 msg_handled_ = old_msg_handled; \
85 return ret; \ 87 return ret; \
86 } \ 88 } \
87 BOOL _ProcessWindowMessage(HWND hWnd, \ 89 BOOL _ProcessWindowMessage(HWND hWnd, \
88 UINT uMsg, \ 90 UINT uMsg, \
89 WPARAM wParam, \ 91 WPARAM wParam, \
90 LPARAM lParam, \ 92 LPARAM lParam, \
91 LRESULT& lResult, \ 93 LRESULT& lResult, \
92 DWORD dwMsgMapID) { \ 94 DWORD dwMsgMapID) { \
93 base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr()); \ 95 base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr()); \
94 BOOL bHandled = TRUE; \ 96 BOOL bHandled = TRUE; \
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 // Time the last WM_MOUSEHWHEEL message is received. Please refer to the 603 // Time the last WM_MOUSEHWHEEL message is received. Please refer to the
602 // HandleMouseEventInternal function as to why this is needed. 604 // HandleMouseEventInternal function as to why this is needed.
603 long last_mouse_hwheel_time_; 605 long last_mouse_hwheel_time_;
604 606
605 DISALLOW_COPY_AND_ASSIGN(HWNDMessageHandler); 607 DISALLOW_COPY_AND_ASSIGN(HWNDMessageHandler);
606 }; 608 };
607 609
608 } // namespace views 610 } // namespace views
609 611
610 #endif // UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_ 612 #endif // UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_
OLDNEW
« 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