Make Window::closeWindow() noop if the window is already closed

The surface handle can be dropped by that time. Also, there is no point
to ask the client to close the window again if it's already closed.
This commit is contained in:
Vlad Zahorodnii 2024-06-14 10:43:58 +03:00
parent ec86640f44
commit ad98069618
4 changed files with 10 additions and 2 deletions

View file

@ -172,7 +172,7 @@ QString InternalWindow::windowRole() const
void InternalWindow::closeWindow()
{
if (m_handle) {
if (!isDeleted()) {
m_handle->hide();
}
}

View file

@ -211,7 +211,9 @@ void LayerShellV1Window::destroyWindow()
void LayerShellV1Window::closeWindow()
{
m_shellSurface->sendClosed();
if (!isDeleted()) {
m_shellSurface->sendClosed();
}
}
Layer LayerShellV1Window::belongsToLayer() const

View file

@ -2031,6 +2031,9 @@ bool X11Window::isCloseable() const
*/
void X11Window::closeWindow()
{
if (isDeleted()) {
return;
}
if (!isCloseable()) {
return;
}

View file

@ -668,6 +668,9 @@ void XdgToplevelWindow::applyWindowRules()
void XdgToplevelWindow::closeWindow()
{
if (isDeleted()) {
return;
}
if (isCloseable()) {
sendPing(PingReason::CloseWindow);
m_shellSurface->sendClose();