Fix segfault on xwayland unmanaged view unmap

master
emersion 7 years ago
parent 28cb412b0d
commit 681f38c878
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

@ -104,14 +104,11 @@ static void handle_commit(struct wl_listener *listener, void *data) {
static void handle_destroy(struct wl_listener *listener, void *data) { static void handle_destroy(struct wl_listener *listener, void *data) {
struct sway_xwayland_surface *sway_surface = struct sway_xwayland_surface *sway_surface =
wl_container_of(listener, sway_surface, destroy); wl_container_of(listener, sway_surface, destroy);
struct wlr_xwayland_surface *xsurface = data;
wl_list_remove(&sway_surface->commit.link); wl_list_remove(&sway_surface->commit.link);
wl_list_remove(&sway_surface->destroy.link); wl_list_remove(&sway_surface->destroy.link);
wl_list_remove(&sway_surface->request_configure.link); wl_list_remove(&sway_surface->request_configure.link);
if (xsurface->override_redirect && xsurface->mapped) {
wl_list_remove(&sway_surface->view->unmanaged_view_link); wl_list_remove(&sway_surface->view->unmanaged_view_link);
wl_list_init(&sway_surface->view->unmanaged_view_link);
}
struct sway_container *parent = container_view_destroy(sway_surface->view->swayc); struct sway_container *parent = container_view_destroy(sway_surface->view->swayc);
if (parent) { if (parent) {
@ -125,11 +122,9 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
static void handle_unmap_notify(struct wl_listener *listener, void *data) { static void handle_unmap_notify(struct wl_listener *listener, void *data) {
struct sway_xwayland_surface *sway_surface = struct sway_xwayland_surface *sway_surface =
wl_container_of(listener, sway_surface, unmap_notify); wl_container_of(listener, sway_surface, unmap_notify);
struct wlr_xwayland_surface *xsurface = data;
if (xsurface->override_redirect && xsurface->mapped) {
wl_list_remove(&sway_surface->view->unmanaged_view_link); wl_list_remove(&sway_surface->view->unmanaged_view_link);
wl_list_init(&sway_surface->view->unmanaged_view_link); wl_list_init(&sway_surface->view->unmanaged_view_link);
}
// take it out of the tree // take it out of the tree
struct sway_container *parent = container_view_destroy(sway_surface->view->swayc); struct sway_container *parent = container_view_destroy(sway_surface->view->swayc);
@ -152,6 +147,7 @@ static void handle_map_notify(struct wl_listener *listener, void *data) {
// put it back into the tree // put it back into the tree
if (wlr_xwayland_surface_is_unmanaged(xsurface) || if (wlr_xwayland_surface_is_unmanaged(xsurface) ||
xsurface->override_redirect) { xsurface->override_redirect) {
wl_list_remove(&sway_surface->view->unmanaged_view_link);
wl_list_insert(&root_container.sway_root->unmanaged_views, wl_list_insert(&root_container.sway_root->unmanaged_views,
&sway_surface->view->unmanaged_view_link); &sway_surface->view->unmanaged_view_link);
} else { } else {
@ -210,6 +206,8 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
sway_view->surface = xsurface->surface; sway_view->surface = xsurface->surface;
sway_surface->view = sway_view; sway_surface->view = sway_view;
wl_list_init(&sway_view->unmanaged_view_link);
// TODO: // TODO:
// - Look up pid and open on appropriate workspace // - Look up pid and open on appropriate workspace
// - Set new view to maximized so it behaves nicely // - Set new view to maximized so it behaves nicely

Loading…
Cancel
Save