| 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 0f15398545073e92465b29a7bf217756288238a9..368a521612be364cd18f71bc0f54b4aaea278252 100644
|
| --- a/mojo/public/cpp/bindings/lib/interface_endpoint_client.cc
|
| +++ b/mojo/public/cpp/bindings/lib/interface_endpoint_client.cc
|
| @@ -281,8 +281,16 @@ void InterfaceEndpointClient::NotifyError() {
|
|
|
| control_message_proxy_.OnConnectionError();
|
|
|
| - if (!error_handler_.is_null())
|
| + if (!error_handler_.is_null()) {
|
| error_handler_.Run();
|
| + } else if (!error_with_reason_handler_.is_null()) {
|
| + // Make a copy on the stack. If we directly pass a reference to a member of
|
| + // |control_message_handler_|, that reference will be invalidated as soon as
|
| + // the user destroys the interface endpoint.
|
| + std::string description = control_message_handler_.disconnect_description();
|
| + error_with_reason_handler_.Run(
|
| + control_message_handler_.disconnect_custom_reason(), description);
|
| + }
|
| }
|
|
|
| bool InterfaceEndpointClient::HandleValidatedMessage(Message* message) {
|
|
|