Skip to content

Commit 0ec94d1

Browse files
Thomas LukaszewiczChromium LUCI CQ
authored andcommitted
Reset PageHandlerInfo in glic::Host::Shutdown()
This CL resets PageHandlerInfo state on in Host::Shutdown() to mitigate potential dangling refs. Shutdown() resets the host `contents_` which owns the GlicPageHandler - so any refs to the page handler must be reset before the contents is destroyed. Bug: 450660162 Change-Id: Ic154b174efe1df4151d90d811191479f8a9fbe82 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7060090 Reviewed-by: Bryant Chandler <[email protected]> Commit-Queue: Tom Lukaszewicz <[email protected]> Cr-Commit-Position: refs/heads/main@{#1532367}
1 parent 116b1c6 commit 0ec94d1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

chrome/browser/glic/host/host.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ void Host::SetDelegate(EmbedderDelegate* new_delegate) {
7777
}
7878

7979
void Host::Shutdown() {
80+
handler_info_.reset();
8081
contents_.reset();
8182
}
8283

@@ -275,7 +276,7 @@ void Host::NotifyWindowIntentToShow() {
275276
}
276277

277278
void Host::UnsetWebClient(GlicWebClientAccess* web_client) {
278-
if (handler_info_ && handler_info_->web_client != web_client) {
279+
if (!handler_info_ || handler_info_->web_client != web_client) {
279280
return;
280281
}
281282

0 commit comments

Comments
 (0)