mirror of
https://github.com/swaywm/sway.git
synced 2025-11-12 13:29:56 -05:00
Fix dangling pointer on focus swap/describe WS
This commit is contained in:
parent
93ac7d43a8
commit
64a183b23d
2 changed files with 11 additions and 1 deletions
|
|
@ -96,6 +96,7 @@ bool set_focused_container(swayc_t *c) {
|
|||
return false;
|
||||
}
|
||||
swayc_t *active_ws = swayc_active_workspace();
|
||||
int active_ws_child_count = active_ws->children->length + active_ws->floating->length;
|
||||
|
||||
swayc_log(L_DEBUG, c, "Setting focus to %p:%ld", c, c->handle);
|
||||
|
||||
|
|
@ -118,6 +119,11 @@ bool set_focused_container(swayc_t *c) {
|
|||
p = p->parent;
|
||||
p->is_focused = false;
|
||||
}
|
||||
// active_ws might have been destroyed by now
|
||||
// (focus swap away from empty ws = destroy ws)
|
||||
if (active_ws_child_count == 0) {
|
||||
active_ws = NULL;
|
||||
}
|
||||
|
||||
// get new focused view and set focus to it.
|
||||
p = get_focused_view(c);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue