From 31e2f9c5d7e33ad772593942b2d9f56aaff863f6 Mon Sep 17 00:00:00 2001 From: David Faure Date: Tue, 17 Sep 2019 13:36:40 +0200 Subject: [PATCH] [KWayland] Port away from deprecated API in Qt 5.14 Test Plan: Builds Reviewers: davidedmundson, zzag Reviewed By: zzag Subscribers: kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D24014 --- .../autotests/client/test_wayland_surface.cpp | 16 +++++++++++----- src/wayland/surface_interface_p.h | 1 + src/wayland/tools/generator.cpp | 4 ++-- src/wayland/tools/testserver/testserver.cpp | 3 +-- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/wayland/autotests/client/test_wayland_surface.cpp b/src/wayland/autotests/client/test_wayland_surface.cpp index d669ec7765..957323bbc2 100644 --- a/src/wayland/autotests/client/test_wayland_surface.cpp +++ b/src/wayland/autotests/client/test_wayland_surface.cpp @@ -393,9 +393,13 @@ void TestWaylandSurface::testAttachBuffer() QImage blue(24, 24, QImage::Format_ARGB32_Premultiplied); blue.fill(QColor(0, 0, 255, 128)); - wl_buffer *blackBuffer = *(m_shm->createBuffer(black).data()); - auto redBuffer = m_shm->createBuffer(red); - auto blueBuffer = m_shm->createBuffer(blue).toStrongRef(); + QSharedPointer blackBufferPtr = m_shm->createBuffer(black).toStrongRef(); + QVERIFY(blackBufferPtr); + wl_buffer *blackBuffer = *(blackBufferPtr.data()); + QSharedPointer redBuffer = m_shm->createBuffer(red).toStrongRef(); + QVERIFY(redBuffer); + QSharedPointer blueBuffer = m_shm->createBuffer(blue).toStrongRef(); + QVERIFY(blueBuffer); QCOMPARE(blueBuffer->format(), KWayland::Client::Buffer::Format::ARGB32); QCOMPARE(blueBuffer->size(), blue.size()); @@ -776,7 +780,8 @@ void TestWaylandSurface::testScale() //attach a buffer of 100x100, our scale is 4, so this should be a size of 25x25 QImage red(100, 100, QImage::Format_ARGB32_Premultiplied); red.fill(QColor(255, 0, 0, 128)); - auto redBuffer = m_shm->createBuffer(red); + QSharedPointer redBuffer = m_shm->createBuffer(red).toStrongRef(); + QVERIFY(redBuffer); s->attachBuffer(redBuffer.data()); s->damage(QRect(0,0, 25,25)); s->commit(Surface::CommitFlag::None); @@ -800,7 +805,8 @@ void TestWaylandSurface::testScale() //set scale and size in one commit, buffer is 50x50 at scale 2 so size should be 25x25 QImage blue(50, 50, QImage::Format_ARGB32_Premultiplied); red.fill(QColor(255, 0, 0, 128)); - auto blueBuffer = m_shm->createBuffer(blue); + QSharedPointer blueBuffer = m_shm->createBuffer(blue).toStrongRef(); + QVERIFY(blueBuffer); s->attachBuffer(blueBuffer.data()); s->setScale(2); s->commit(Surface::CommitFlag::None); diff --git a/src/wayland/surface_interface_p.h b/src/wayland/surface_interface_p.h index c6103ba0db..d361aadc8f 100644 --- a/src/wayland/surface_interface_p.h +++ b/src/wayland/surface_interface_p.h @@ -23,6 +23,7 @@ License along with this library. If not, see . #include "surface_interface.h" #include "resource_p.h" // Qt +#include #include // Wayland #include diff --git a/src/wayland/tools/generator.cpp b/src/wayland/tools/generator.cpp index 84630d3fc0..e59641974a 100644 --- a/src/wayland/tools/generator.cpp +++ b/src/wayland/tools/generator.cpp @@ -500,7 +500,7 @@ void Generator::startAuthorNameProcess() QStringLiteral("user.name") }); git->setProgram(QStringLiteral("git")); - connect(git, static_cast(&QProcess::finished), this, + connect(git, static_cast(&QProcess::finished), this, [this, git] { QMutexLocker locker(&m_mutex); m_authorName = QString::fromLocal8Bit(git->readAllStandardOutput()).trimmed(); @@ -520,7 +520,7 @@ void Generator::startAuthorEmailProcess() QStringLiteral("user.email") }); git->setProgram(QStringLiteral("git")); - connect(git, static_cast(&QProcess::finished), this, + connect(git, static_cast(&QProcess::finished), this, [this, git] { QMutexLocker locker(&m_mutex); m_authorEmail = QString::fromLocal8Bit(git->readAllStandardOutput()).trimmed(); diff --git a/src/wayland/tools/testserver/testserver.cpp b/src/wayland/tools/testserver/testserver.cpp index 7931bbe5e9..c80bed365b 100644 --- a/src/wayland/tools/testserver/testserver.cpp +++ b/src/wayland/tools/testserver/testserver.cpp @@ -183,8 +183,7 @@ void TestServer::startTestApp(const QString &app, const QStringList &arguments) p->setProcessEnvironment(environment); auto finishedSignal = static_cast(&QProcess::finished); connect(p, finishedSignal, QCoreApplication::instance(), &QCoreApplication::exit); - auto errorSignal = static_cast(&QProcess::error); - connect(p, errorSignal, this, + connect(p, &QProcess::errorOccurred, this, [] { QCoreApplication::instance()->exit(1); }