Commit f64375c0 authored by Michael Hansen's avatar Michael Hansen Committed by Commit Bot

[Nearby] Prevent crash on potential double close of sharesheet.

This clears the controller in the OnClose() method to prevent a crash
in the event that the OnClose() callback runs more than once before the
animation is complete. This surfaced as a crash when sending a file.

Fixed: 1150176
Change-Id: I13aa8eaf3bf3f5e382d31376825f647ab287a7dc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2548373
Commit-Queue: Michael Hansen <hansenmichael@google.com>
Reviewed-by: default avatarJames Vecore <vecore@google.com>
Cr-Commit-Position: refs/heads/master@{#829050}
parent d44ab4ee
......@@ -119,6 +119,10 @@ void NearbyShareAction::OnClose() {
// The nearby WebUI requested to close through user action
if (controller_) {
controller_->CloseSharesheet();
// We need to clear out the controller here to protect against calling
// CloseShareSheet() more than once, which will cause a crash.
controller_ = nullptr;
}
}
......
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