mirror of https://github.com/qt/qtgrpc.git
tst_grpc_client: port from QSharedPointer to std::unique_ptr
The sharing capabilities of shared_ptr aren't used here, so use a const unique_ptr, aka a scoped pointer. Pick-to: 6.5 Task-number: QTBUG-108833 Change-Id: I55977d18744627f56603d64816a6f13f254ab06f Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
c4754ea69e
commit
bdac28b542
|
|
@ -20,6 +20,8 @@
|
|||
#include <QtCore/QThread>
|
||||
#include <QtCore/QTimer>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#if QT_CONFIG(native_grpc)
|
||||
# include <grpcpp/security/credentials.h>
|
||||
#endif
|
||||
|
|
@ -600,7 +602,7 @@ void QtGrpcClientTest::CallStringThreadTest()
|
|||
QVERIFY(clientErrorSpy.isValid());
|
||||
|
||||
bool ok = false;
|
||||
QSharedPointer<QThread> thread(QThread::create([&] {
|
||||
const std::unique_ptr<QThread> thread(QThread::create([&] {
|
||||
ok = _client->testMethod(request, result.get()) == QGrpcStatus::Ok;
|
||||
}));
|
||||
|
||||
|
|
@ -623,7 +625,7 @@ void QtGrpcClientTest::StringAsyncThreadTest()
|
|||
QSignalSpy clientErrorSpy(_client.get(), &TestService::Client::errorOccurred);
|
||||
QVERIFY(clientErrorSpy.isValid());
|
||||
|
||||
QSharedPointer<QThread> thread(QThread::create([&] {
|
||||
const std::unique_ptr<QThread> thread(QThread::create([&] {
|
||||
QEventLoop waiter;
|
||||
std::shared_ptr<QGrpcCallReply> reply = _client->testMethod(request);
|
||||
QObject::connect(reply.get(), &QGrpcCallReply::finished, &waiter,
|
||||
|
|
@ -654,7 +656,7 @@ void QtGrpcClientTest::StreamStringThreadTest()
|
|||
QVERIFY(clientErrorSpy.isValid());
|
||||
|
||||
int i = 0;
|
||||
QSharedPointer<QThread> thread(QThread::create([&] {
|
||||
const std::unique_ptr<QThread> thread(QThread::create([&] {
|
||||
QEventLoop waiter;
|
||||
auto stream = _client->streamTestMethodServerStream(request);
|
||||
QObject::connect(stream.get(), &QGrpcStream::messageReceived, &waiter,
|
||||
|
|
|
|||
Loading…
Reference in New Issue