| Index: ui/aura/mus/input_method_mus.cc
|
| diff --git a/ui/aura/mus/input_method_mus.cc b/ui/aura/mus/input_method_mus.cc
|
| index d86152d6c9416e800edebe4f7ee5b214792f0aab..c67c2228856e50ebafc545105de9f43de899ebb0 100644
|
| --- a/ui/aura/mus/input_method_mus.cc
|
| +++ b/ui/aura/mus/input_method_mus.cc
|
| @@ -195,6 +195,12 @@ void InputMethodMus::AckPendingCallbacksUnhandled() {
|
| void InputMethodMus::ProcessKeyEventCallback(
|
| const ui::KeyEvent& event,
|
| bool handled) {
|
| + // Remove the callback as DispatchKeyEventPostIME() may lead to calling
|
| + // AckPendingCallbacksUnhandled(), which mutates |pending_callbacks_|.
|
| + DCHECK(!pending_callbacks_.empty());
|
| + std::unique_ptr<EventResultCallback> ack_callback =
|
| + std::move(pending_callbacks_.front());
|
| + pending_callbacks_.pop_front();
|
| EventResult event_result;
|
| if (!handled) {
|
| // If not handled by IME, try dispatching the event to delegate to see if
|
| @@ -207,10 +213,6 @@ void InputMethodMus::ProcessKeyEventCallback(
|
| } else {
|
| event_result = EventResult::HANDLED;
|
| }
|
| - DCHECK(!pending_callbacks_.empty());
|
| - std::unique_ptr<EventResultCallback> ack_callback =
|
| - std::move(pending_callbacks_.front());
|
| - pending_callbacks_.pop_front();
|
| // |ack_callback| can be null if the standard form of DispatchKeyEvent() is
|
| // called instead of the version which provides a callback. In mus+ash we
|
| // use the version with callback, but some unittests use the standard form.
|
|
|