Revert "Add wrapper for wl_global_remove"

This reverts commit 78a8b6877c.

Despite being a useful fix for an important crash it forces a dependency on
libwayland 1.8, which some distros don't have.
This commit is contained in:
David Edmundson 2020-04-29 09:58:07 +01:00 committed by Aleix Pol
parent 768de2aac4
commit 9ef8ce53ce
3 changed files with 1 additions and 66 deletions

View file

@ -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(&registry, &Registry::blurAnnounced);
QSignalSpy blurRemovedSpy(&registry, &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<KWayland::Client::Surface> surface(m_compositor->createSurface());
QVERIFY(serverSurfaceCreated.wait());
auto serverSurface = serverSurfaceCreated.first().first().value<KWaylandServer::SurfaceInterface*>();
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<KWayland::Client::Blur> 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"

View file

@ -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<Private*>(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) {

View file

@ -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.
**/