[server] Add a convenient ClientConnection::destroy

Wrapper around wl_client_destroy. In case the ClientConnection got
created through Display::createClient we need to destroy the
ClientConnection again. The exiting client will not cause it to be
destroyed.

Reviewed-By: Bhushan Shah
This commit is contained in:
Martin Gräßlin 2015-11-10 13:27:27 +01:00
parent f19fedb0f6
commit 868282fb08
3 changed files with 15 additions and 1 deletions

View file

@ -169,7 +169,7 @@ void TestWaylandServerDisplay::testClientConnection()
QVERIFY(disconnectedSpy.isEmpty());
wl_client_destroy(client);
QCOMPARE(disconnectedSpy.count(), 1);
wl_client_destroy(*client2);
client2->destroy();
QCOMPARE(disconnectedSpy.count(), 2);
close(sv[0]);
close(sv[1]);

View file

@ -95,6 +95,11 @@ void ClientConnection::flush()
wl_client_flush(d->client);
}
void ClientConnection::destroy()
{
wl_client_destroy(d->client);
}
wl_resource *ClientConnection::createResource(const wl_interface *interface, quint32 version, quint32 id)
{
return wl_resource_create(d->client, interface, version, id);

View file

@ -117,6 +117,15 @@ public:
**/
operator wl_client*() const;
/**
* Destroys this ClientConnection.
* This is a convenient wrapper around wl_client_destroy. The use case is in combination
* with ClientConnections created through @link Display::createClient @endlink. E.g. once
* the process for the ClientConnection exited, the ClientConnection needs to be destroyed, too.
* @since 5.5
**/
void destroy();
Q_SIGNALS:
/**
* Signal emitted when the ClientConnection got disconnected from the server.