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

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

Issue 576323003: Fix use after free in HWNDMessageHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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.cc
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc
index d726ea930d98d95feceb2da247503f41c5fabb27..f589c84dee2f2385e87388c91674f22aa75212cc 100644
--- a/ui/views/win/hwnd_message_handler.cc
+++ b/ui/views/win/hwnd_message_handler.cc
@@ -1452,8 +1452,11 @@ LRESULT HWNDMessageHandler::OnImeMessages(UINT message,
WPARAM w_param,
LPARAM l_param) {
LRESULT result = 0;
- SetMsgHandled(delegate_->HandleIMEMessage(
- message, w_param, l_param, &result));
+ base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr());
+ const bool msg_handled =
+ delegate_->HandleIMEMessage(message, w_param, l_param, &result);
+ if (ref.get())
+ SetMsgHandled(msg_handled);
return result;
}
« 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