diff options
author | emersion <contact@emersion.fr> | 2018-08-03 09:56:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-03 09:56:46 +0100 |
commit | b49904dd7ebe00d2779a4278eca92d7a558dd03d (patch) | |
tree | 66221fabcc5fb7d5986936d52d56a757ea01909a /sway/tree | |
parent | 16c1e21f26ad47fb3ecfee994b19c5215734a543 (diff) | |
parent | 854c5fbec872ee093cc2728558f69f7f567f3136 (diff) | |
download | sway-b49904dd7ebe00d2779a4278eca92d7a558dd03d.tar.xz |
Merge pull request #2414 from RyanDwyer/fix-inactive-fullscreen-crash
Fix crash when fullscreen view closes on inactive workspace
Diffstat (limited to 'sway/tree')
-rw-r--r-- | sway/tree/view.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c index 97318daa..78baa705 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -592,19 +592,18 @@ void view_unmap(struct sway_view *view) { view->urgent_timer = NULL; } - struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE); - - struct sway_container *parent; - if (container_is_fullscreen_or_child(view->swayc)) { - parent = container_destroy(view->swayc); - arrange_windows(ws->parent); - } else { - parent = container_destroy(view->swayc); - arrange_windows(parent); - } - if (parent->type >= C_WORKSPACE) { // if the workspace still exists + bool was_fullscreen = view->swayc->is_fullscreen; + struct sway_container *surviving_ancestor = container_destroy(view->swayc); + + // If the workspace wasn't reaped + if (surviving_ancestor->type >= C_WORKSPACE) { + struct sway_container *ws = surviving_ancestor->type == C_WORKSPACE ? + surviving_ancestor : + container_parent(surviving_ancestor, C_WORKSPACE); + arrange_windows(was_fullscreen ? ws : surviving_ancestor); workspace_detect_urgent(ws); } + transaction_commit_dirty(); view->surface = NULL; } |