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

Unified Diff: services/ui/surfaces/display_compositor.cc

Issue 2673823002: display compositor: Fix a use-after-free when a frame sink is destroyed. (Closed)
Patch Set: . Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/ui/surfaces/display_compositor.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/surfaces/display_compositor.cc
diff --git a/services/ui/surfaces/display_compositor.cc b/services/ui/surfaces/display_compositor.cc
index 6c922fdde40d268ade043f6d4cc334a515bed69a..b022b427513302d476642d788cae236145c217c2 100644
--- a/services/ui/surfaces/display_compositor.cc
+++ b/services/ui/surfaces/display_compositor.cc
@@ -55,7 +55,7 @@ void DisplayCompositor::OnClientConnectionLost(
bool destroy_compositor_frame_sink) {
DCHECK(thread_checker_.CalledOnValidThread());
if (destroy_compositor_frame_sink)
- compositor_frame_sinks_.erase(frame_sink_id);
+ DestroyCompositorFrameSink(frame_sink_id);
// TODO(fsamuel): Tell the display compositor host that the client connection
// has been lost so that it can drop its private connection and allow a new
// client instance to create a new CompositorFrameSink.
@@ -66,7 +66,7 @@ void DisplayCompositor::OnPrivateConnectionLost(
bool destroy_compositor_frame_sink) {
DCHECK(thread_checker_.CalledOnValidThread());
if (destroy_compositor_frame_sink)
- compositor_frame_sinks_.erase(frame_sink_id);
+ DestroyCompositorFrameSink(frame_sink_id);
}
void DisplayCompositor::CreateDisplayCompositorFrameSink(
@@ -155,6 +155,10 @@ std::unique_ptr<cc::Display> DisplayCompositor::CreateDisplay(
base::MakeUnique<cc::TextureMailboxDeleter>(task_runner_.get()));
}
+void DisplayCompositor::DestroyCompositorFrameSink(cc::FrameSinkId sink_id) {
+ compositor_frame_sinks_.erase(sink_id);
+}
+
void DisplayCompositor::OnSurfaceCreated(const cc::SurfaceInfo& surface_info) {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK_GT(surface_info.device_scale_factor(), 0.0f);
« no previous file with comments | « services/ui/surfaces/display_compositor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698