mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2024-11-25 16:42:26 +00:00
xwm: Destroy xwm on hangup or error
If Xwayland is restarted, the ready handler assumes there is no xwm instance. This means all of xwm was leaked on Xwayland restart. This caused compositors to consume all cpu resources, where time is spent dispatching. Now we destroy xwm if we get an event mask containing WL_EVENT_HANGUP or WL_EVENT_ERROR.
This commit is contained in:
parent
84d2f30faa
commit
b1a47245a1
@ -1312,6 +1312,11 @@ static int x11_event_handler(int fd, uint32_t mask, void *data) {
|
|||||||
xcb_generic_event_t *event;
|
xcb_generic_event_t *event;
|
||||||
struct wlr_xwm *xwm = data;
|
struct wlr_xwm *xwm = data;
|
||||||
|
|
||||||
|
if ((mask & WL_EVENT_HANGUP) || (mask & WL_EVENT_ERROR)) {
|
||||||
|
xwm_destroy(xwm);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
while ((event = xcb_poll_for_event(xwm->xcb_conn))) {
|
while ((event = xcb_poll_for_event(xwm->xcb_conn))) {
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
@ -1493,6 +1498,7 @@ void xwm_destroy(struct wlr_xwm *xwm) {
|
|||||||
wl_list_remove(&xwm->compositor_destroy.link);
|
wl_list_remove(&xwm->compositor_destroy.link);
|
||||||
xcb_disconnect(xwm->xcb_conn);
|
xcb_disconnect(xwm->xcb_conn);
|
||||||
|
|
||||||
|
xwm->xwayland->xwm = NULL;
|
||||||
free(xwm);
|
free(xwm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user