From af1b3d97550c749de4e71f50784dc17f1a31c135 Mon Sep 17 00:00:00 2001 From: taiyu Date: Tue, 18 Aug 2015 04:09:43 -0700 Subject: [PATCH] fixed floating window crashing bug --- sway/handlers.c | 1 - sway/layout.c | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sway/handlers.c b/sway/handlers.c index 0157d466f..ebfd22ad4 100644 --- a/sway/handlers.c +++ b/sway/handlers.c @@ -168,7 +168,6 @@ static bool handle_view_created(wlc_handle handle) { static void handle_view_destroyed(wlc_handle handle) { sway_log(L_DEBUG, "Destroying window %lu", handle); swayc_t *view = get_swayc_for_handle(handle, &root_container); - swayc_t *focused = get_focused_container(&root_container); switch (wlc_view_get_type(handle)) { //regular view created regularly diff --git a/sway/layout.c b/sway/layout.c index 8ff5c4b72..d072c410c 100644 --- a/sway/layout.c +++ b/sway/layout.c @@ -226,7 +226,8 @@ void arrange_windows(swayc_t *container, int width, int height) { // will be kept up to date so that more recently focused views // have higher indexes // This is conditional on there not being a fullscreen view in the workspace - if (!(wlc_view_get_state(container->focused->handle) & WLC_BIT_FULLSCREEN)) { + if (!container->focused + || !(wlc_view_get_state(container->focused->handle) & WLC_BIT_FULLSCREEN)) { wlc_view_bring_to_front(view->handle); } }