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

Side by Side Diff: ui/aura/window_event_dispatcher.cc

Issue 651323002: Fixing a "use after free". (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding a comment Created 6 years, 2 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 | ui/views/touchui/touch_selection_controller_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/aura/window_event_dispatcher.h" 5 #include "ui/aura/window_event_dispatcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 if (mouse_moved_handler_ && !window()->Contains(mouse_moved_handler_)) 371 if (mouse_moved_handler_ && !window()->Contains(mouse_moved_handler_))
372 mouse_moved_handler_ = NULL; 372 mouse_moved_handler_ = NULL;
373 373
374 if (old_capture && old_capture->GetRootWindow() == window() && 374 if (old_capture && old_capture->GetRootWindow() == window() &&
375 old_capture->delegate()) { 375 old_capture->delegate()) {
376 // Send a capture changed event with bogus location data. 376 // Send a capture changed event with bogus location data.
377 ui::MouseEvent event(ui::ET_MOUSE_CAPTURE_CHANGED, gfx::Point(), 377 ui::MouseEvent event(ui::ET_MOUSE_CAPTURE_CHANGED, gfx::Point(),
378 gfx::Point(), 0, 0); 378 gfx::Point(), 0, 0);
379 379
380 DispatchDetails details = DispatchEvent(old_capture, &event); 380 DispatchDetails details = DispatchEvent(old_capture, &event);
381 if (details.dispatcher_destroyed) 381 if (details.dispatcher_destroyed || details.target_destroyed)
sky 2014/10/14 22:55:50 How about test coverage?
382 return; 382 return;
383 383
384 old_capture->delegate()->OnCaptureLost(); 384 old_capture->delegate()->OnCaptureLost();
385 } 385 }
386 386
387 if (new_capture) { 387 if (new_capture) {
388 // Make all subsequent mouse events go to the capture window. We shouldn't 388 // Make all subsequent mouse events go to the capture window. We shouldn't
389 // need to send an event here as OnCaptureLost() should take care of that. 389 // need to send an event here as OnCaptureLost() should take care of that.
390 if (mouse_moved_handler_ || Env::GetInstance()->IsMouseButtonDown()) 390 if (mouse_moved_handler_ || Env::GetInstance()->IsMouseButtonDown())
391 mouse_moved_handler_ = new_capture; 391 mouse_moved_handler_ = new_capture;
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 897
898 default: 898 default:
899 NOTREACHED(); 899 NOTREACHED();
900 break; 900 break;
901 } 901 }
902 902
903 PreDispatchLocatedEvent(target, event); 903 PreDispatchLocatedEvent(target, event);
904 } 904 }
905 905
906 } // namespace aura 906 } // namespace aura
OLDNEW
« no previous file with comments | « no previous file | ui/views/touchui/touch_selection_controller_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698