x11window: Sync xcb_sync_destroy_alarm to lifetime of the window being alive

Recent-ish changes meant that the X11 window is kept alive whilst an
effect may be using the window.

This changes the lifetime of the sync alarm. This is problematic in the
case of an XWayland crash, we can assume whilst an X11 client is valid
the X11 connection is also valid, but if a close animation is used the
connection might not be valid when the destructor is called.
This commit is contained in:
David Edmundson 2023-10-11 16:44:51 +01:00
parent 364afe0f69
commit ad45dcb40b

View file

@ -360,9 +360,7 @@ X11Window::~X11Window()
::kill(m_killHelperPID, SIGTERM);
m_killHelperPID = 0;
}
if (m_syncRequest.alarm != XCB_NONE) {
xcb_sync_destroy_alarm(kwinApp()->x11Connection(), m_syncRequest.alarm);
}
Q_ASSERT(!isInteractiveMoveResize());
Q_ASSERT(!check_active_modal);
}
@ -458,7 +456,10 @@ void X11Window::releaseWindow(bool on_shutdown)
unblockGeometryUpdates(); // Don't use GeometryUpdatesBlocker, it would now set the geometry
ungrabXServer();
}
if (m_syncRequest.alarm != XCB_NONE) {
xcb_sync_destroy_alarm(kwinApp()->x11Connection(), m_syncRequest.alarm);
m_syncRequest.alarm = XCB_NONE;
}
unblockCompositing();
unref();
}
@ -504,6 +505,10 @@ void X11Window::destroyWindow()
m_frame.reset();
unblockGeometryUpdates(); // Don't use GeometryUpdatesBlocker, it would now set the geometry
}
if (m_syncRequest.alarm != XCB_NONE) {
xcb_sync_destroy_alarm(kwinApp()->x11Connection(), m_syncRequest.alarm);
m_syncRequest.alarm = XCB_NONE;
}
unblockCompositing();
unref();