From 9ef8ce53ce4850b55aa8d63d86e56a1400eec507 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 29 Apr 2020 09:58:07 +0100 Subject: [PATCH] Revert "Add wrapper for wl_global_remove" This reverts commit 78a8b6877c50556fdfe1cee465e0e5d04c2e8364. Despite being a useful fix for an important crash it forces a dependency on libwayland 1.8, which some distros don't have. --- .../autotests/client/test_wayland_blur.cpp | 37 ------------------- src/wayland/server/global.cpp | 12 +----- src/wayland/server/global.h | 18 --------- 3 files changed, 1 insertion(+), 66 deletions(-) diff --git a/src/wayland/autotests/client/test_wayland_blur.cpp b/src/wayland/autotests/client/test_wayland_blur.cpp index d883bd19e6..46b028ac06 100644 --- a/src/wayland/autotests/client/test_wayland_blur.cpp +++ b/src/wayland/autotests/client/test_wayland_blur.cpp @@ -31,7 +31,6 @@ private Q_SLOTS: void testCreate(); void testSurfaceDestroy(); - void testGlobalDestroy(); private: KWaylandServer::Display *m_display; @@ -198,41 +197,5 @@ void TestBlur::testSurfaceDestroy() QVERIFY(blurDestroyedSpy.wait()); } - -void TestBlur::testGlobalDestroy() -{ - Registry registry; - QSignalSpy blurAnnouncedSpy(®istry, &Registry::blurAnnounced); - QSignalSpy blurRemovedSpy(®istry, &Registry::blurRemoved); - - registry.setEventQueue(m_queue); - - registry.create(m_connection->display()); - QVERIFY(registry.isValid()); - registry.setup(); - - QVERIFY(blurAnnouncedSpy.wait()); - - QSignalSpy serverSurfaceCreated(m_compositorInterface, &KWaylandServer::CompositorInterface::surfaceCreated); - QScopedPointer surface(m_compositor->createSurface()); - QVERIFY(serverSurfaceCreated.wait()); - - auto serverSurface = serverSurfaceCreated.first().first().value(); - QSignalSpy blurChanged(serverSurface, &KWaylandServer::SurfaceInterface::blurChanged); - - m_blurManagerInterface->remove(); - - // we've deleted our global, but the clients have some operations in flight as they haven't processed this yet - // when we process them, we should not throw an error and kill the client - - QScopedPointer blur(m_blurManager->createBlur(surface.data())); - blur->setRegion(m_compositor->createRegion(QRegion(0, 0, 10, 20), nullptr)); - blur->commit(); - surface->commit(KWayland::Client::Surface::CommitFlag::None); - - // client finally sees the blur is gone - QVERIFY(blurRemovedSpy.wait()); -} - QTEST_GUILESS_MAIN(TestBlur) #include "test_wayland_blur.moc" diff --git a/src/wayland/server/global.cpp b/src/wayland/server/global.cpp index 34806bc3e8..df723d182a 100644 --- a/src/wayland/server/global.cpp +++ b/src/wayland/server/global.cpp @@ -24,14 +24,12 @@ Global::Private::~Private() = default; void Global::Private::bind(wl_client *client, void *data, uint32_t version, uint32_t id) { auto d = reinterpret_cast(data); - if (!d) { - return; - } d->bind(client, version, id); } void Global::Private::create() { + Q_ASSERT(!global); global = wl_global_create(*display, m_interface, m_version, this, bind); } @@ -51,14 +49,6 @@ void Global::create() d->create(); } -void Global::remove() -{ - if (!d->global) { - return; - } - wl_global_remove(d->global); -} - void Global::destroy() { if (!d->global) { diff --git a/src/wayland/server/global.h b/src/wayland/server/global.h index d493dd2ee9..023ef2bc20 100644 --- a/src/wayland/server/global.h +++ b/src/wayland/server/global.h @@ -51,24 +51,6 @@ public: * to the clients. **/ void create(); - - /** - * Removes the Global from the registry, but does not delete the underlying wl_global - * - * Removal of a global is racey. A client could be trying to bind at that moment. - * Typically globals are static for the lifespan of the compositor, however there are exceptions - * - * For those cases this call will remove the global from the registry, but keep the wl_global instance alive - * and handling bind requests. - * - * The compositor can then remove the Global wrapper (this object) deleting the wl_global after an arbitrary delay or - * keep it around for re-use for the duration of the compositor. - * - * See https://gitlab.freedesktop.org/wayland/wayland/issues/10 - * - * @since 5.70 - */ - void remove(); /** * Destroys the low level wl_global. Afterwards the Global is no longer shown to clients. **/