mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-22 02:01:55 +07:00
layout: Fix crash due to workspace cleanup during switch
This commit is contained in:
@@ -542,6 +542,7 @@ impl<W: LayoutElement> Layout<W> {
|
||||
if !ws.has_windows()
|
||||
&& idx != mon.active_workspace_idx
|
||||
&& idx != mon.workspaces.len() - 1
|
||||
&& mon.workspace_switch.is_none()
|
||||
{
|
||||
mon.workspaces.remove(idx);
|
||||
|
||||
@@ -2286,6 +2287,22 @@ mod tests {
|
||||
check_ops_with_options(options, &ops);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn workspace_cleanup_during_switch() {
|
||||
let ops = [
|
||||
Op::AddOutput(1),
|
||||
Op::AddWindow {
|
||||
id: 1,
|
||||
bbox: Rectangle::from_loc_and_size((0, 0), (100, 200)),
|
||||
min_max_size: (Size::from((0, 0)), Size::from((i32::MAX, i32::MAX))),
|
||||
},
|
||||
Op::FocusWorkspaceDown,
|
||||
Op::CloseWindow(1),
|
||||
];
|
||||
|
||||
check_ops(&ops);
|
||||
}
|
||||
|
||||
fn arbitrary_spacing() -> impl Strategy<Value = u16> {
|
||||
// Give equal weight to:
|
||||
// - 0: the element is disabled
|
||||
|
||||
Reference in New Issue
Block a user