From c2fc33872efd213df435f16bc41aa6d20bf558ca Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 12 May 2021 22:36:12 +0300 Subject: [PATCH] Introduce ClientConnection::aboutToBeDestroyed This signal is useful if the compositor wants to perform some cleanup before the disconnected signal is emitted or while the connection object still has valid wl_client native handle. --- src/wayland/clientconnection.cpp | 1 + src/wayland/clientconnection.h | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/wayland/clientconnection.cpp b/src/wayland/clientconnection.cpp index 8e2152ee76..3068e7d651 100644 --- a/src/wayland/clientconnection.cpp +++ b/src/wayland/clientconnection.cpp @@ -68,6 +68,7 @@ void ClientConnectionPrivate::destroyListenerCallback(wl_listener *listener, voi Q_ASSERT(it != s_allClients.constEnd()); auto p = (*it); auto q = p->q; + emit q->aboutToBeDestroyed(); p->client = nullptr; wl_list_remove(&p->listener.link); emit q->disconnected(q); diff --git a/src/wayland/clientconnection.h b/src/wayland/clientconnection.h index c75db64947..d84b2c9105 100644 --- a/src/wayland/clientconnection.h +++ b/src/wayland/clientconnection.h @@ -123,6 +123,10 @@ public: void destroy(); Q_SIGNALS: + /** + * This signal is emitted when the client is about to be destroyed. + */ + void aboutToBeDestroyed(); /** * Signal emitted when the ClientConnection got disconnected from the server. */