| Index: mojo/public/cpp/bindings/lib/interface_endpoint_client.cc
|
| diff --git a/mojo/public/cpp/bindings/lib/interface_endpoint_client.cc b/mojo/public/cpp/bindings/lib/interface_endpoint_client.cc
|
| index 2a02ef202f47455b80875d4a423da1648e7b1614..a6a9c0686bb839f27869ce80a2533e751a749c2c 100644
|
| --- a/mojo/public/cpp/bindings/lib/interface_endpoint_client.cc
|
| +++ b/mojo/public/cpp/bindings/lib/interface_endpoint_client.cc
|
| @@ -280,9 +280,11 @@ void InterfaceEndpointClient::NotifyError() {
|
| return;
|
| encountered_error_ = true;
|
|
|
| - // The callbacks may hold on to resources. There is no need to keep them any
|
| - // longer.
|
| - async_responders_.clear();
|
| + // Response callbacks may hold on to resource, and there's no need to keep
|
| + // them alive any longer. Note that it's allowed that a pending response
|
| + // callback may own this endpoint, so we simply move the responders onto the
|
| + // stack here and let them be destroyed when the stack unwinds.
|
| + AsyncResponderMap responders = std::move(async_responders_);
|
|
|
| control_message_proxy_.OnConnectionError();
|
|
|
|
|