Commit 115594ca authored by Bao-Duy Tran's avatar Bao-Duy Tran Committed by Chromium LUCI CQ

Add defensive null guard to speculatively fix nullptr crash.

Window::GetRootWindow() returns a nullable but there's currently no null
guard nor DCHECK at callsite KeyboardUIController::DeactivateKeyboard().
This is causing some nullptr crash. The crash cannot be repro'd manually
and it's unclear as to why this didn't cause issues earlier.

Bug: 1162338
Change-Id: I40baabcb32aa4d41943af27372c8e2410c2d49f9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2612587Reviewed-by: default avatarDarren Shen <shend@chromium.org>
Commit-Queue: Bao-Duy Tran <tranbaoduy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841323}
parent a7744013
......@@ -295,7 +295,10 @@ void KeyboardUIController::DeactivateKeyboard() {
parent_container_->RemoveChild(keyboard_window);
}
}
parent_container_->GetRootWindow()->RemoveObserver(this);
aura::Window* root_window = parent_container_->GetRootWindow();
if (root_window) {
root_window->RemoveObserver(this);
}
parent_container_ = 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