Commit 93abffae authored by Mustafa Emre Acer's avatar Mustafa Emre Acer Committed by Commit Bot

[SB Delayed Warnings] Fix crash when the old RVH is shut down

Bug: 1130092
Change-Id: I50224da935beb436f2828ef8047435882a044452
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2419389Reviewed-by: default avatarDaniel Rubery <drubery@chromium.org>
Commit-Queue: Mustafa Emre Acer <meacer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#809182}
parent 89cc507a
...@@ -143,10 +143,13 @@ SafeBrowsingUserInteractionObserver::FromWebContents( ...@@ -143,10 +143,13 @@ SafeBrowsingUserInteractionObserver::FromWebContents(
void SafeBrowsingUserInteractionObserver::RenderViewHostChanged( void SafeBrowsingUserInteractionObserver::RenderViewHostChanged(
content::RenderViewHost* old_host, content::RenderViewHost* old_host,
content::RenderViewHost* new_host) { content::RenderViewHost* new_host) {
old_host->GetWidget()->RemoveKeyPressEventCallback(key_press_callback_); // |old_host| can be nullptr if the old RVH was shut down.
if (old_host)
old_host->GetWidget()->RemoveKeyPressEventCallback(key_press_callback_);
new_host->GetWidget()->AddKeyPressEventCallback(key_press_callback_); new_host->GetWidget()->AddKeyPressEventCallback(key_press_callback_);
old_host->GetWidget()->RemoveMouseEventCallback(mouse_event_callback_); if (old_host)
old_host->GetWidget()->RemoveMouseEventCallback(mouse_event_callback_);
new_host->GetWidget()->AddMouseEventCallback(mouse_event_callback_); new_host->GetWidget()->AddMouseEventCallback(mouse_event_callback_);
} }
......
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