Fix potential UAF of CefBPDNativeAura::window_widget_

This commit is contained in:
Marshall Greenblatt
2023-02-06 15:43:00 -08:00
parent adfa59f690
commit f34406c57d
6 changed files with 48 additions and 10 deletions

View File

@@ -216,6 +216,12 @@ gfx::Vector2d CefBrowserPlatformDelegateNativeAura::GetUiWheelEventOffset(
return gfx::Vector2d(deltaX, deltaY);
}
base::OnceClosure
CefBrowserPlatformDelegateNativeAura::GetWidgetDeleteCallback() {
return base::BindOnce(&CefBrowserPlatformDelegateNativeAura::WidgetDeleted,
weak_ptr_factory_.GetWeakPtr());
}
// static
base::TimeTicks CefBrowserPlatformDelegateNativeAura::GetEventTimeStamp() {
return base::TimeTicks::Now();
@@ -279,6 +285,11 @@ int CefBrowserPlatformDelegateNativeAura::TranslateUiChangedButtonFlags(
return result;
}
void CefBrowserPlatformDelegateNativeAura::WidgetDeleted() {
DCHECK(window_widget_);
window_widget_ = nullptr;
}
content::RenderWidgetHostViewAura*
CefBrowserPlatformDelegateNativeAura::GetHostView() const {
if (!web_contents_) {