diff --git a/src/core/lib/surface/call.cc b/src/core/lib/surface/call.cc index 67656c68464..e4da1f9cf36 100644 --- a/src/core/lib/surface/call.cc +++ b/src/core/lib/surface/call.cc @@ -3176,10 +3176,11 @@ class ServerCall final : public Call, public DualRefCounted { void CancelWithError(grpc_error_handle error) override { call_handler_.SpawnInfallible( - "CancelWithError", [this, error = std::move(error)] { + "CancelWithError", + [self = WeakRefAsSubclass(), error = std::move(error)] { auto status = ServerMetadataFromStatus(error); status->Set(GrpcCallWasCancelled(), true); - call_handler_.PushServerTrailingMetadata(std::move(status)); + self->call_handler_.PushServerTrailingMetadata(std::move(status)); return Empty{}; }); }