diff --git a/src/wayland/autotests/client/test_shm_pool.cpp b/src/wayland/autotests/client/test_shm_pool.cpp index a41457153f..45e238b6bf 100644 --- a/src/wayland/autotests/client/test_shm_pool.cpp +++ b/src/wayland/autotests/client/test_shm_pool.cpp @@ -157,7 +157,7 @@ void TestShmPool::testCreateBufferFromImage() QImage img(24, 24, QImage::Format_ARGB32); img.fill(Qt::black); QVERIFY(!img.isNull()); - auto buffer = m_shmPool->createBuffer(img); + auto buffer = m_shmPool->createBuffer(img).toStrongRef(); QVERIFY(buffer); QCOMPARE(buffer->size(), img.size()); QImage img2(buffer->address(), img.width(), img.height(), QImage::Format_ARGB32); @@ -170,7 +170,7 @@ void TestShmPool::testCreateBufferFromData() QImage img(24, 24, QImage::Format_ARGB32); img.fill(Qt::black); QVERIFY(!img.isNull()); - auto buffer = m_shmPool->createBuffer(img.size(), img.bytesPerLine(), img.constBits()); + auto buffer = m_shmPool->createBuffer(img.size(), img.bytesPerLine(), img.constBits()).toStrongRef(); QVERIFY(buffer); QCOMPARE(buffer->size(), img.size()); QImage img2(buffer->address(), img.width(), img.height(), QImage::Format_ARGB32); @@ -183,13 +183,13 @@ void TestShmPool::testReuseBuffer() QImage img(24, 24, QImage::Format_ARGB32); img.fill(Qt::black); QVERIFY(!img.isNull()); - auto buffer = m_shmPool->createBuffer(img); + auto buffer = m_shmPool->createBuffer(img).toStrongRef(); QVERIFY(buffer); buffer->setReleased(true); buffer->setUsed(false); // same image should get the same buffer - auto buffer2 = m_shmPool->createBuffer(img); + auto buffer2 = m_shmPool->createBuffer(img).toStrongRef(); QCOMPARE(buffer, buffer2); buffer2->setReleased(true); buffer2->setUsed(false); @@ -202,7 +202,7 @@ void TestShmPool::testReuseBuffer() QImage img2(24, 24, QImage::Format_RGB32); img2.fill(Qt::black); QVERIFY(!img2.isNull()); - auto buffer4 = m_shmPool->createBuffer(img2); + auto buffer4 = m_shmPool->createBuffer(img2).toStrongRef(); QVERIFY(buffer4); QVERIFY(buffer4 != buffer2); QVERIFY(buffer4 != buffer3); diff --git a/src/wayland/autotests/client/test_wayland_surface.cpp b/src/wayland/autotests/client/test_wayland_surface.cpp index f94c92a455..ea6b14fa7c 100644 --- a/src/wayland/autotests/client/test_wayland_surface.cpp +++ b/src/wayland/autotests/client/test_wayland_surface.cpp @@ -265,9 +265,9 @@ void TestWaylandSurface::testAttachBuffer() QImage blue(24, 24, QImage::Format_ARGB32_Premultiplied); blue.fill(QColor(0, 0, 255, 128)); - wl_buffer *blackBuffer = *(pool.createBuffer(black)); - KWayland::Client::Buffer *redBuffer = pool.createBuffer(red); - KWayland::Client::Buffer *blueBuffer = pool.createBuffer(blue); + wl_buffer *blackBuffer = *(pool.createBuffer(black).data()); + auto redBuffer = pool.createBuffer(red); + auto blueBuffer = pool.createBuffer(blue).toStrongRef(); QCOMPARE(blueBuffer->format(), KWayland::Client::Buffer::Format::ARGB32); QCOMPARE(blueBuffer->size(), blue.size()); @@ -275,7 +275,7 @@ void TestWaylandSurface::testAttachBuffer() QVERIFY(!blueBuffer->isUsed()); QCOMPARE(blueBuffer->stride(), blue.bytesPerLine()); - s->attachBuffer(redBuffer); + s->attachBuffer(redBuffer.data()); s->attachBuffer(blackBuffer); s->damage(QRect(0, 0, 24, 24)); s->commit(KWayland::Client::Surface::CommitFlag::None); @@ -303,12 +303,12 @@ void TestWaylandSurface::testAttachBuffer() QCOMPARE(buffer2->data().format(), QImage::Format_ARGB32); buffer2->unref(); QVERIFY(buffer2->isReferenced()); - QVERIFY(!redBuffer->isReleased()); + QVERIFY(!redBuffer.data()->isReleased()); // render another frame blueBuffer->setUsed(true); QVERIFY(blueBuffer->isUsed()); - s->attachBuffer(blueBuffer); + s->attachBuffer(blueBuffer.data()); s->damage(QRect(0, 0, 24, 24)); QSignalSpy frameRenderedSpy(s, SIGNAL(frameRendered())); QVERIFY(frameRenderedSpy.isValid()); @@ -319,7 +319,7 @@ void TestWaylandSurface::testAttachBuffer() delete buffer2; // TODO: we should have a signal on when the Buffer gets released QTest::qWait(100); - QVERIFY(redBuffer->isReleased()); + QVERIFY(redBuffer.data()->isReleased()); KWayland::Server::BufferInterface *buffer3 = serverSurface->buffer(); buffer3->ref();