viz: Fix FrameSinkManagerImpl use-after-free.
If a [Root]CompositorFrameSinkImpl in FrameSinkManagerImpls |compositor_frame_sinks_| wasn't deleted before FrameSinkManagerImpl is destroyed then we can end up running the CompositorFrameSinkSupport destructor twice. It looks like flat_map::clear() runs the CompositorFrameSinkSupport destructor before removing the items from the map, so when CompositorFrameSinkSupport calls back into FrameSinkManagerImpl::UnregisterCompositorFrameSinkSupport() the entry is still in the map and gets removed, running the CompositorFrameSinkSupport destructor a second time. Separate the map that contains SinkAndSupport into two maps. This will avoid future errors using iterators after they've been invalidated. |sink_map_| can be removed with OOP-D when all CompositorFrameSinks are owned inside FrameSinkManagerImpl. This is a different approach to https://crrev.com/c/874813 which was reverted. Bug: 803405 Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel Change-Id: I92c230e57dc471f4b16125b0edb3a0618c01930f Reviewed-on: https://chromium-review.googlesource.com/891424Reviewed-by:Fady Samuel <fsamuel@chromium.org> Commit-Queue: kylechar <kylechar@chromium.org> Cr-Commit-Position: refs/heads/master@{#532685}
Showing
Please register or sign in to comment