Fix a memory leak during window.close

We weren't actually destroying the window or removing its link if the
window was closed while it didn't have an output.
This commit is contained in:
Ben Buhse 2026-02-18 15:46:35 -06:00
commit 3a7975eb1f
No known key found for this signature in database
GPG key ID: 7916ACFCD38FD0B4

View file

@ -150,8 +150,8 @@ fn windowListener(river_window_v1: *river.WindowV1, event: river.WindowV1.Event,
seat.pending_manage.pointer_resize_request = null;
}
}
// If there's no output, we don't really care about focus and can skip this event
const output = if (window.output) |output| output else return;
if (window.output) |output| {
// Get a new window for the wm to focus
var it = window.context.wm.seats.iterator(.forward);
while (it.next()) |seat| {
if (seat.focused_window == window) {
@ -169,6 +169,7 @@ fn windowListener(river_window_v1: *river.WindowV1, event: river.WindowV1.Event,
}
}
}
}
window.link.remove();
window.destroy();
},