mirror of
https://codeberg.org/dwl/dwl.git
synced 2026-04-08 08:21:00 -04:00
fix crash when the last monitor is disconnected
This commit is contained in:
parent
3e6d584de1
commit
6e2bb01818
1 changed files with 5 additions and 4 deletions
3
dwl.c
3
dwl.c
|
|
@ -720,10 +720,11 @@ cleanupmon(struct wl_listener *listener, void *data)
|
||||||
wl_list_remove(&m->link);
|
wl_list_remove(&m->link);
|
||||||
wlr_output_layout_remove(output_layout, m->wlr_output);
|
wlr_output_layout_remove(output_layout, m->wlr_output);
|
||||||
|
|
||||||
nmons = wl_list_length(&mons);
|
if ((nmons = wl_list_length(&mons)))
|
||||||
do // don't switch to disabled mons
|
do // don't switch to disabled mons
|
||||||
selmon = wl_container_of(mons.prev, selmon, link);
|
selmon = wl_container_of(mons.prev, selmon, link);
|
||||||
while (!selmon->wlr_output->enabled && i++ < nmons);
|
while (!selmon->wlr_output->enabled && i++ < nmons);
|
||||||
|
|
||||||
focusclient(focustop(selmon), 1);
|
focusclient(focustop(selmon), 1);
|
||||||
closemon(m);
|
closemon(m);
|
||||||
free(m);
|
free(m);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue