Avoid comparing streams by value

Comparing steams by value shouldn't happen, it's artifact that left
from the stream reuse mechanism.

Pick-to: 6.5
Change-Id: Ib9c5ee3e616d1a0bc75853a87ab15461dbf76f91
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
This commit is contained in:
Alexey Edelev 2023-05-17 19:59:53 +02:00
parent 8f4ec7436c
commit d2d8f0915c
2 changed files with 2 additions and 9 deletions

View File

@ -211,11 +211,9 @@ std::shared_ptr<QGrpcStream> QAbstractGrpcClient::startStream(QLatin1StringView
Q_D(QAbstractGrpcClient); Q_D(QAbstractGrpcClient);
qGrpcWarning() qGrpcWarning()
<< grpcStream->method() << "call" << d->service << "stream finished."; << grpcStream->method() << "call" << d->service << "stream finished.";
auto it = std::find_if(d->activeStreams.begin(), d->activeStreams.end(),
[grpcStream](std::shared_ptr<QGrpcStream> activeStream) {
return *activeStream == *grpcStream;
});
auto it =
std::find(d->activeStreams.begin(), d->activeStreams.end(), grpcStream);
if (it != d->activeStreams.end()) if (it != d->activeStreams.end())
d->activeStreams.erase(it); d->activeStreams.erase(it);

View File

@ -32,11 +32,6 @@ public:
QByteArrayView arg() const; QByteArrayView arg() const;
void updateData(const QByteArray &data); void updateData(const QByteArray &data);
bool operator==(const QGrpcStream &other) const
{
return other.method() == method() && other.arg() == arg();
}
Q_SIGNALS: Q_SIGNALS:
void messageReceived(); void messageReceived();