Index: mojo/public/cpp/bindings/lib/binding_state.h |
diff --git a/mojo/public/cpp/bindings/lib/binding_state.h b/mojo/public/cpp/bindings/lib/binding_state.h |
index 82b1a327b21a13d318f9bf82d3de6e4c473472d0..1950289644860ccddb63a2a7749b70609775521c 100644 |
--- a/mojo/public/cpp/bindings/lib/binding_state.h |
+++ b/mojo/public/cpp/bindings/lib/binding_state.h |
@@ -89,6 +89,7 @@ class BindingState<Interface, false> { |
} |
void set_connection_error_handler(const Closure& error_handler) { |
+ DCHECK(is_bound()); |
connection_error_handler_ = error_handler; |
} |
@@ -113,6 +114,7 @@ class BindingState<Interface, false> { |
router_->set_connection_error_handler(Closure()); |
delete router_; |
router_ = nullptr; |
+ connection_error_handler_.reset(); |
} |
internal::Router* router_ = nullptr; |
@@ -175,6 +177,7 @@ class BindingState<Interface, true> { |
endpoint_client_.reset(); |
router_->CloseMessagePipe(); |
router_ = nullptr; |
+ connection_error_handler_.reset(); |
} |
InterfaceRequest<Interface> Unbind() { |
@@ -182,10 +185,12 @@ class BindingState<Interface, true> { |
InterfaceRequest<Interface> request = |
MakeRequest<Interface>(router_->PassMessagePipe()); |
router_ = nullptr; |
+ connection_error_handler_.reset(); |
return request.Pass(); |
} |
void set_connection_error_handler(const Closure& error_handler) { |
+ DCHECK(is_bound()); |
connection_error_handler_ = error_handler; |
} |