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

Side by Side Diff: ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc

Issue 796253002: Fix use-after-free when browser is closed during a drop-drop on desktop Linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
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/widget/desktop_aura/desktop_drag_drop_client_aurax11.h" 5 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.h"
6 6
7 #include <X11/Xatom.h> 7 #include <X11/Xatom.h>
8 8
9 #include "base/event_types.h" 9 #include "base/event_types.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 g_live_client_map.Get()[xwindow] = this; 424 g_live_client_map.Get()[xwindow] = this;
425 425
426 // Mark that we are aware of drag and drop concepts. 426 // Mark that we are aware of drag and drop concepts.
427 unsigned long xdnd_version = kMinXdndVersion; 427 unsigned long xdnd_version = kMinXdndVersion;
428 XChangeProperty(xdisplay_, xwindow_, atom_cache_.GetAtom("XdndAware"), 428 XChangeProperty(xdisplay_, xwindow_, atom_cache_.GetAtom("XdndAware"),
429 XA_ATOM, 32, PropModeReplace, 429 XA_ATOM, 32, PropModeReplace,
430 reinterpret_cast<unsigned char*>(&xdnd_version), 1); 430 reinterpret_cast<unsigned char*>(&xdnd_version), 1);
431 } 431 }
432 432
433 DesktopDragDropClientAuraX11::~DesktopDragDropClientAuraX11() { 433 DesktopDragDropClientAuraX11::~DesktopDragDropClientAuraX11() {
434 // This is necessary when the parent native widget gets destroyed while a drag
435 // operation is in progress.
436 move_loop_->EndMoveLoop();
437 NotifyDragLeave();
438
434 g_live_client_map.Get().erase(xwindow_); 439 g_live_client_map.Get().erase(xwindow_);
435 // Make sure that all observers are unregistered from source and target
436 // windows. This may be necessary when the parent native widget gets destroyed
437 // while a drag operation is in progress.
438 NotifyDragLeave();
439 } 440 }
440 441
441 // static 442 // static
442 DesktopDragDropClientAuraX11* DesktopDragDropClientAuraX11::GetForWindow( 443 DesktopDragDropClientAuraX11* DesktopDragDropClientAuraX11::GetForWindow(
443 ::Window window) { 444 ::Window window) {
444 std::map< ::Window, DesktopDragDropClientAuraX11*>::const_iterator it = 445 std::map< ::Window, DesktopDragDropClientAuraX11*>::const_iterator it =
445 g_live_client_map.Get().find(window); 446 g_live_client_map.Get().find(window);
446 if (it == g_live_client_map.Get().end()) 447 if (it == g_live_client_map.Get().end())
447 return NULL; 448 return NULL;
448 return it->second; 449 return it->second;
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 for (int x = 0; x < in_bitmap->width(); ++x) { 1192 for (int x = 0; x < in_bitmap->width(); ++x) {
1192 if (SkColorGetA(in_row[x]) > kMinAlpha) 1193 if (SkColorGetA(in_row[x]) > kMinAlpha)
1193 return true; 1194 return true;
1194 } 1195 }
1195 } 1196 }
1196 1197
1197 return false; 1198 return false;
1198 } 1199 }
1199 1200
1200 } // namespace views 1201 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698