Merge pull request #2414 from RyanDwyer/fix-inactive-fullscreen-crash

Fix crash when fullscreen view closes on inactive workspace
This commit is contained in:
emersion 2018-08-03 09:56:46 +01:00 committed by GitHub
commit b49904dd7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 10 deletions

View File

@ -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);
bool was_fullscreen = view->swayc->is_fullscreen;
struct sway_container *surviving_ancestor = container_destroy(view->swayc);
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
// 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;
}