From 4e0452fce3bfc96db6f6f2951794cbb26e75ccd7 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sun, 2 Sep 2018 15:37:56 +1000 Subject: Fix scratchpad related crashes * Was crashing when a view was moved to the scratchpad (prev focus had no parent). * Was crashing when a hidden scratchpad view unmaps because it has no workspace. --- sway/input/seat.c | 5 ++++- sway/tree/view.c | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/sway/input/seat.c b/sway/input/seat.c index 502ed5ac..92d9d7ec 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -618,7 +618,10 @@ void seat_set_focus_warp(struct sway_seat *seat, struct sway_node *node, if (last_focus) { seat_send_unfocus(last_focus, seat); node_set_dirty(last_focus); - node_set_dirty(node_get_parent(last_focus)); + struct sway_node *parent = node_get_parent(last_focus); + if (parent) { + node_set_dirty(parent); + } } // Put the container parents on the focus stack, then the workspace, then diff --git a/sway/tree/view.c b/sway/tree/view.c index 1b8d5738..57851b16 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -560,11 +560,11 @@ void view_unmap(struct sway_view *view) { container_begin_destroy(view->container); if (parent) { container_reap_empty(parent); - } else { + } else if (ws) { workspace_consider_destroy(ws); } - if (!ws->node.destroying) { + if (ws && !ws->node.destroying) { arrange_workspace(ws); workspace_detect_urgent(ws); } -- cgit v1.2.3-54-g00ecf