From 4ca287641f1c73799601de391243b0d318ca377b Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 12 Aug 2021 13:03:35 +0300 Subject: [PATCH] wayland: Destroy xdg shell clients when corresponding roles are about to be destroyed This ensures that surface role objects can be still accessed when either XdgToplevelClient or XdgPopupClient is destroyed. As far as I know, it doesn't cause any problems right now, but this makes resource destruction handling consistent, we tend to perform cleanup in aboutToBeDestroyed signal slots. --- src/xdgshellclient.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/xdgshellclient.cpp b/src/xdgshellclient.cpp index a2e04251b3..4e1bd853cf 100644 --- a/src/xdgshellclient.cpp +++ b/src/xdgshellclient.cpp @@ -54,6 +54,8 @@ XdgSurfaceClient::XdgSurfaceClient(XdgSurfaceInterface *shellSurface) connect(shellSurface->surface(), &SurfaceInterface::mapped, this, &XdgSurfaceClient::setReadyForPainting); #endif + connect(shellSurface, &XdgSurfaceInterface::aboutToBeDestroyed, + this, &XdgSurfaceClient::destroyClient); connect(shellSurface->surface(), &SurfaceInterface::aboutToBeDestroyed, this, &XdgSurfaceClient::destroyClient); @@ -390,7 +392,7 @@ XdgToplevelClient::XdgToplevelClient(XdgToplevelInterface *shellSurface) this, &XdgToplevelClient::handleTransientForChanged); connect(shellSurface, &XdgToplevelInterface::initializeRequested, this, &XdgToplevelClient::initialize); - connect(shellSurface, &XdgToplevelInterface::destroyed, + connect(shellSurface, &XdgToplevelInterface::aboutToBeDestroyed, this, &XdgToplevelClient::destroyClient); connect(shellSurface, &XdgToplevelInterface::maximumSizeChanged, this, &XdgToplevelClient::handleMaximumSizeChanged); @@ -1749,7 +1751,7 @@ XdgPopupClient::XdgPopupClient(XdgPopupInterface *shellSurface) this, &XdgPopupClient::initialize); connect(shellSurface, &XdgPopupInterface::repositionRequested, this, &XdgPopupClient::handleRepositionRequested); - connect(shellSurface, &XdgPopupInterface::destroyed, + connect(shellSurface, &XdgPopupInterface::aboutToBeDestroyed, this, &XdgPopupClient::destroyClient); }