mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
xwayland: prevent crash due to unexpected surface dissociate events
Fixes #1360 Fixes #1466
This commit is contained in:
parent
396a4b93d1
commit
22b02f70e5
2 changed files with 32 additions and 0 deletions
|
|
@ -135,6 +135,19 @@ handle_dissociate(struct wl_listener *listener, void *data)
|
||||||
struct xwayland_unmanaged *unmanaged =
|
struct xwayland_unmanaged *unmanaged =
|
||||||
wl_container_of(listener, unmanaged, dissociate);
|
wl_container_of(listener, unmanaged, dissociate);
|
||||||
|
|
||||||
|
if (!unmanaged->mappable.connected) {
|
||||||
|
/*
|
||||||
|
* In some cases wlroots fails to emit the associate event
|
||||||
|
* due to an early return in xwayland_surface_associate().
|
||||||
|
* This is arguably a wlroots bug, but nevertheless it
|
||||||
|
* should not bring down labwc.
|
||||||
|
*
|
||||||
|
* TODO: Potentially remove when starting to track
|
||||||
|
* wlroots 0.18 and it got fixed upstream.
|
||||||
|
*/
|
||||||
|
wlr_log(WLR_ERROR, "dissociate received before associate");
|
||||||
|
return;
|
||||||
|
}
|
||||||
mappable_disconnect(&unmanaged->mappable);
|
mappable_disconnect(&unmanaged->mappable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -225,6 +238,9 @@ xwayland_unmanaged_create(struct server *server,
|
||||||
CONNECT_SIGNAL(xsurface, unmanaged, request_configure);
|
CONNECT_SIGNAL(xsurface, unmanaged, request_configure);
|
||||||
CONNECT_SIGNAL(xsurface, unmanaged, set_override_redirect);
|
CONNECT_SIGNAL(xsurface, unmanaged, set_override_redirect);
|
||||||
|
|
||||||
|
if (xsurface->surface) {
|
||||||
|
handle_associate(&unmanaged->associate, NULL);
|
||||||
|
}
|
||||||
if (mapped) {
|
if (mapped) {
|
||||||
handle_map(&unmanaged->mappable.map, NULL);
|
handle_map(&unmanaged->mappable.map, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -252,6 +252,19 @@ handle_dissociate(struct wl_listener *listener, void *data)
|
||||||
struct xwayland_view *xwayland_view =
|
struct xwayland_view *xwayland_view =
|
||||||
wl_container_of(listener, xwayland_view, dissociate);
|
wl_container_of(listener, xwayland_view, dissociate);
|
||||||
|
|
||||||
|
if (!xwayland_view->base.mappable.connected) {
|
||||||
|
/*
|
||||||
|
* In some cases wlroots fails to emit the associate event
|
||||||
|
* due to an early return in xwayland_surface_associate().
|
||||||
|
* This is arguably a wlroots bug, but nevertheless it
|
||||||
|
* should not bring down labwc.
|
||||||
|
*
|
||||||
|
* TODO: Potentially remove when starting to track
|
||||||
|
* wlroots 0.18 and it got fixed upstream.
|
||||||
|
*/
|
||||||
|
wlr_log(WLR_ERROR, "dissociate received before associate");
|
||||||
|
return;
|
||||||
|
}
|
||||||
mappable_disconnect(&xwayland_view->base.mappable);
|
mappable_disconnect(&xwayland_view->base.mappable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -855,6 +868,9 @@ xwayland_view_create(struct server *server,
|
||||||
|
|
||||||
wl_list_insert(&view->server->views, &view->link);
|
wl_list_insert(&view->server->views, &view->link);
|
||||||
|
|
||||||
|
if (xsurface->surface) {
|
||||||
|
handle_associate(&xwayland_view->associate, NULL);
|
||||||
|
}
|
||||||
if (mapped) {
|
if (mapped) {
|
||||||
xwayland_view_map(view);
|
xwayland_view_map(view);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue