From 834805f5e260bcc77d714323d4a7f4bfd1dbfb17 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Tue, 26 Jun 2018 19:40:42 +1000 Subject: Fix crash when disconnecting output We were freeing the sway_output immediately upon disconnect which left a dangling pointer in the output's container. It then tried to use the pointer when the container is freed. We don't need to store the sway_output in an output's container which is destroying, so the fix is to set the pointer to NULL and remove the use in container_free. Also added an arrange when the output is disconnected for good measure. --- sway/desktop/output.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sway/desktop') diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 790751c3..34fefaa9 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -1271,6 +1271,8 @@ static void handle_destroy(struct wl_listener *listener, void *data) { wl_list_remove(&output->destroy.link); output->wlr_output->data = NULL; free(output); + + arrange_and_commit(&root_container); } static void handle_mode(struct wl_listener *listener, void *data) { -- cgit v1.2.3