fix: dangling raw_ptr in OSRWHV destructor (#41088)

`delegated_frame_host_` holds a pointer to `delegated_frame_host_client_`.
Since `delegated_frame_host_client_` was being destroyed first, that
pointer was dangling in the OSRWHV destructor.

Also, make these two unique_ptr fields `const` since they point to the
same objects for the lifespan of the OSRWHV.
This commit is contained in:
Charles Kerr 2024-01-24 19:15:32 -06:00 committed by GitHub
parent 3e6a038af7
commit 921da723b8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 11 deletions

View file

@ -279,17 +279,22 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
viz::ParentLocalSurfaceIdAllocator compositor_allocator_;
std::unique_ptr<ui::Layer> root_layer_;
// depends-on: root_layer_
std::unique_ptr<ui::Compositor> compositor_;
std::unique_ptr<content::DelegatedFrameHost> delegated_frame_host_;
// depends-on: render_widget_host_, root_layer_
const std::unique_ptr<ElectronDelegatedFrameHostClient>
delegated_frame_host_client_;
// depends-on: delegated_frame_host_client_
const std::unique_ptr<content::DelegatedFrameHost> delegated_frame_host_;
std::unique_ptr<content::CursorManager> cursor_manager_;
raw_ptr<OffScreenHostDisplayClient> host_display_client_;
std::unique_ptr<OffScreenVideoConsumer> video_consumer_;
std::unique_ptr<ElectronDelegatedFrameHostClient>
delegated_frame_host_client_;
content::MouseWheelPhaseHandler mouse_wheel_phase_handler_;
// Latest capture sequence number which is incremented when the caller