Commit 02a56c78 authored by Keishi Hattori's avatar Keishi Hattori Committed by Chromium LUCI CQ

Fix destruction order in WebUIImpl for BackupRefPtr

When BackupRefPtr is used for WebUIImpl::web_contents_, the destruction order of the fields causes a null dereference.
This is because BackupRefPtr is cleared in the destructor.
The destructor of WebUIMessageHandler subclasses are accessing the WebContentsImpl through WebUIImpl::web_contents_.

Bug: 1080832
Change-Id: I24570aad42dbd09febd94ef6d25be31c9817c091
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2564979Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Reviewed-by: default avatarBartek Nowierski <bartekn@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Keishi Hattori <keishi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#834108}
parent 828f303b
...@@ -121,15 +121,15 @@ class CONTENT_EXPORT WebUIImpl : public WebUI, ...@@ -121,15 +121,15 @@ class CONTENT_EXPORT WebUIImpl : public WebUI,
// The URL schemes that can be requested by this document. // The URL schemes that can be requested by this document.
std::vector<std::string> requestable_schemes_; std::vector<std::string> requestable_schemes_;
// The WebUIMessageHandlers we own.
std::vector<std::unique_ptr<WebUIMessageHandler>> handlers_;
// RenderFrameHost associated with |this|. // RenderFrameHost associated with |this|.
RenderFrameHost* frame_host_; RenderFrameHost* frame_host_;
// Non-owning pointer to the WebContentsImpl this WebUI is associated with. // Non-owning pointer to the WebContentsImpl this WebUI is associated with.
WebContentsImpl* web_contents_; WebContentsImpl* web_contents_;
// The WebUIMessageHandlers we own.
std::vector<std::unique_ptr<WebUIMessageHandler>> handlers_;
// Notifies this WebUI about notifications in the main frame. // Notifies this WebUI about notifications in the main frame.
std::unique_ptr<WebUIMainFrameObserver> web_contents_observer_; std::unique_ptr<WebUIMainFrameObserver> web_contents_observer_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment