fix: guard output size reads against VT-loss teardown

This commit is contained in:
Andrew Hamilton 2026-09-11 08:04:05 +10:00
parent 650ca3ba50
commit 8a69b99ae5

10
kick.c
View file

@ -3442,7 +3442,8 @@ static void clients_set_fullscreen(bool fs) {
wl_list_for_each(w, &t->windows, link) {
if (!window_initialized(w)) continue;
window_set_fullscreen(w, fs);
if (!fs && (w->toplevel || w->origin != ORIGIN_GROUP ||
if (!fs && server.output &&
(w->toplevel || w->origin != ORIGIN_GROUP ||
w->tab != w->parent_tab)) {
window_set_maximized(w, true);
window_set_size(w, server.output->width, server.output->height);
@ -3507,8 +3508,11 @@ static void handle_toplevel_commit(struct wl_listener *listener, void *data) {
struct wlr_xdg_toplevel *toplevel = w->toplevel;
if (toplevel->base->initial_commit) {
wlr_xdg_toplevel_set_maximized(toplevel, true);
wlr_xdg_toplevel_set_size(toplevel, server.output->width,
server.output->height);
/* No output while standalone lost its VT (destroyed until the
connector is re-added): size then, not now, or this deref faults. */
if (server.output)
wlr_xdg_toplevel_set_size(toplevel, server.output->width,
server.output->height);
if (server.clients_fullscreen)
wlr_xdg_toplevel_set_fullscreen(toplevel, true);
}