Commit ea417ed7 authored by Xiaocheng Hu's avatar Xiaocheng Hu Committed by Commit Bot

[Spellchecker] Ensure that we don't remove uncalled RequestTextCheckCallback on Android

Mojo doesn't allow removing an uncalled mojo callback while the message pipe is
still open.

On Android, SpellCheckerSessionBridge::DisconnectSession() can discard pending
requests while the message pipe is still open, violating the requirement. This
patch fixes it by running the callbacks with empty result before removing them.

Bug: 843845
Change-Id: I2ab4d51eeb43e63d9715eb42187d51656886fea5
Reviewed-on: https://chromium-review.googlesource.com/1065148Reviewed-by: default avatarRachel Blum <groby@chromium.org>
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#560317}
parent c1500889
......@@ -139,4 +139,8 @@ SpellCheckerSessionBridge::SpellingRequest::SpellingRequest(
RequestTextCheckCallback callback)
: text_(text), callback_(std::move(callback)) {}
SpellCheckerSessionBridge::SpellingRequest::~SpellingRequest() {}
SpellCheckerSessionBridge::SpellingRequest::~SpellingRequest() {
// Ensure that we don't clear an uncalled RequestTextCheckCallback
if (callback_)
std::move(callback_).Run(std::vector<SpellCheckResult>());
}
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