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:
parent
dc1e38e737
commit
3a7975eb1f
1 changed files with 14 additions and 13 deletions
|
|
@ -150,22 +150,23 @@ fn windowListener(river_window_v1: *river.WindowV1, event: river.WindowV1.Event,
|
||||||
seat.pending_manage.pointer_resize_request = null;
|
seat.pending_manage.pointer_resize_request = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If there's no output, we don't really care about focus and can skip this event
|
if (window.output) |output| {
|
||||||
const output = if (window.output) |output| output else return;
|
// Get a new window for the wm to focus
|
||||||
var it = window.context.wm.seats.iterator(.forward);
|
var it = window.context.wm.seats.iterator(.forward);
|
||||||
while (it.next()) |seat| {
|
while (it.next()) |seat| {
|
||||||
if (seat.focused_window == window) {
|
if (seat.focused_window == window) {
|
||||||
// Find another window to focus and warp pointer there
|
// Find another window to focus and warp pointer there
|
||||||
if (output.prevWindow(window)) |next_focus| {
|
if (output.prevWindow(window)) |next_focus| {
|
||||||
if (next_focus != window) {
|
if (next_focus != window) {
|
||||||
seat.pending_manage.window = .{ .window = next_focus };
|
seat.pending_manage.window = .{ .window = next_focus };
|
||||||
seat.pending_manage.should_warp_pointer = true;
|
seat.pending_manage.should_warp_pointer = true;
|
||||||
|
} else {
|
||||||
|
// Only window in list - clear focus
|
||||||
|
seat.pending_manage.window = .clear_focus;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Only window in list - clear focus
|
|
||||||
seat.pending_manage.window = .clear_focus;
|
seat.pending_manage.window = .clear_focus;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
seat.pending_manage.window = .clear_focus;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue