[go: up one dir, main page]

[M76 Merge] Fix crash when pressing Assistant suggestion chip.

Previously a crash could occur because the Suggestion associated with
the suggestion chip may get destroyed during the OpenUrl sequence,
leaving us with a reference to a bad GURL.

To address this, we now post the OpenUrl to a task when handling
OnSuggestionChipPressed events. In addition to fixing the crash, this
also prevents any other observers of this event in the future from
receiving notification of the event with a bad pointer.

Note that there is potential for a similar crash when handling
notification clicks in the future, so handling that here as well. This
case does not require posting.

(cherry picked from commit c0f7696202f4172cf4683716b4338e86c5041924)

Bug: b:134773721
Change-Id: I0a178fc849c70b3015631ac2d9f7617395f616ff
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1646598
Commit-Queue: David Black <dmblack@google.com>
Reviewed-by: Xiaohui Chen <xiaohuic@chromium.org>
Reviewed-by: Tao Wu <wutao@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#667766}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1653073
Cr-Commit-Position: refs/branch-heads/3809@{#232}
Cr-Branched-From: d82dec1a818f378c464ba307ddd9c92133eac355-refs/heads/master@{#665002}
2 files changed