Commit 3918d7bb authored by James Cook's avatar James Cook Committed by Commit Bot

cros: Fix crash when opening keyboard shortcut overlay from settings

Crash was introduced in commit 8f1e606d

More than one part of chrome calls mojo methods in NewWindowController,
so there can be more than one binding. I've audited the other changes
in the above CL and they should be OK, so keeping this change small
for easier backport.

Bug: 794581
Test: ash_unittests, chrome unit_tests and browser_tests, manually open keyboard shortcut overlay from webui settings > keyboard section
Change-Id: I6b274ecd7b8e6c0c366c36a398e9094b4c361dd9
Reviewed-on: https://chromium-review.googlesource.com/826026Reviewed-by: default avatarMichael Wasserman <msw@chromium.org>
Commit-Queue: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#523969}
parent cab63f4b
......@@ -8,13 +8,13 @@
namespace ash {
NewWindowController::NewWindowController() : binding_(this) {}
NewWindowController::NewWindowController() = default;
NewWindowController::~NewWindowController() = default;
void NewWindowController::BindRequest(
mojom::NewWindowControllerRequest request) {
binding_.Bind(std::move(request));
bindings_.AddBinding(this, std::move(request));
}
void NewWindowController::SetClient(
......
......@@ -9,7 +9,7 @@
#include "ash/public/interfaces/new_window.mojom.h"
#include "base/macros.h"
#include "mojo/public/cpp/bindings/associated_binding.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "mojo/public/cpp/bindings/binding_set.h"
namespace ash {
......@@ -38,7 +38,9 @@ class ASH_EXPORT NewWindowController : public mojom::NewWindowController {
void OpenFeedbackPage();
private:
mojo::Binding<mojom::NewWindowController> binding_;
// More than one part of chrome may connect to call the mojo methods, so use
// BindingSet instead of Binding. http://crbug.com/794581
mojo::BindingSet<mojom::NewWindowController> bindings_;
mojom::NewWindowClientAssociatedPtr client_;
......
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