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

Side by Side 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 unified diff | Download patch
« 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 #include "ui/views/win/hwnd_message_handler.h" 5 #include "ui/views/win/hwnd_message_handler.h"
6 6
7 #include <dwmapi.h> 7 #include <dwmapi.h>
8 #include <oleacc.h> 8 #include <oleacc.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #include <wtsapi32.h> 10 #include <wtsapi32.h>
(...skipping 1434 matching lines...) Expand 10 before | Expand all | Expand 10 after
1445 static_cast<IAccessible*>(root.Detach())); 1445 static_cast<IAccessible*>(root.Detach()));
1446 } 1446 }
1447 1447
1448 return reference_result; 1448 return reference_result;
1449 } 1449 }
1450 1450
1451 LRESULT HWNDMessageHandler::OnImeMessages(UINT message, 1451 LRESULT HWNDMessageHandler::OnImeMessages(UINT message,
1452 WPARAM w_param, 1452 WPARAM w_param,
1453 LPARAM l_param) { 1453 LPARAM l_param) {
1454 LRESULT result = 0; 1454 LRESULT result = 0;
1455 SetMsgHandled(delegate_->HandleIMEMessage( 1455 base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr());
1456 message, w_param, l_param, &result)); 1456 const bool msg_handled =
1457 delegate_->HandleIMEMessage(message, w_param, l_param, &result);
1458 if (ref.get())
1459 SetMsgHandled(msg_handled);
1457 return result; 1460 return result;
1458 } 1461 }
1459 1462
1460 void HWNDMessageHandler::OnInitMenu(HMENU menu) { 1463 void HWNDMessageHandler::OnInitMenu(HMENU menu) {
1461 bool is_fullscreen = fullscreen_handler_->fullscreen(); 1464 bool is_fullscreen = fullscreen_handler_->fullscreen();
1462 bool is_minimized = IsMinimized(); 1465 bool is_minimized = IsMinimized();
1463 bool is_maximized = IsMaximized(); 1466 bool is_maximized = IsMaximized();
1464 bool is_restored = !is_fullscreen && !is_minimized && !is_maximized; 1467 bool is_restored = !is_fullscreen && !is_minimized && !is_maximized;
1465 1468
1466 ScopedRedrawLock lock(this); 1469 ScopedRedrawLock lock(this);
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after
2460 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_HIDEWINDOW); 2463 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_HIDEWINDOW);
2461 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_SHOWWINDOW); 2464 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_SHOWWINDOW);
2462 } 2465 }
2463 // WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want 2466 // WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want
2464 // to notify our children too, since we can have MDI child windows who need to 2467 // to notify our children too, since we can have MDI child windows who need to
2465 // update their appearance. 2468 // update their appearance.
2466 EnumChildWindows(hwnd(), &SendDwmCompositionChanged, NULL); 2469 EnumChildWindows(hwnd(), &SendDwmCompositionChanged, NULL);
2467 } 2470 }
2468 2471
2469 } // namespace views 2472 } // namespace views
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