mirror of
https://github.com/swaywm/sway.git
synced 2026-04-21 06:46:22 -04:00
When a container is moved, `finalize_move` previously assumed that calling `workspace_split` would always result in a workspace with exactly 1 child (the wrapper container). Consequently, it safely assumed that inserting a container with `after = 1` was always valid. However, if the moved container was the only child of its workspace, calling `container_detach` drops the workspace's tiling length to 0. Calling `workspace_split` on an empty workspace simply changes its layout enum and returns, leaving the length at 0. Passing `after` (which evaluates to 1 when moving right/down) into `workspace_insert_tiling` then causes an out-of-bounds insertion and a subsequent segmentation fault during `container_build_representation`. This commit fixes the issue by dynamically calculating the insertion index based on the actual length of the workspace's tiling list at the moment of insertion, rather than overloading the `after` boolean flag as a hardcoded index. |
||
|---|---|---|
| .. | ||
| commands | ||
| config | ||
| desktop | ||
| input | ||
| tree | ||
| commands.c | ||
| config.c | ||
| criteria.c | ||
| decoration.c | ||
| ipc-json.c | ||
| ipc-server.c | ||
| lock.c | ||
| main.c | ||
| meson.build | ||
| realtime.c | ||
| scene_descriptor.c | ||
| server.c | ||
| sway-bar.5.scd | ||
| sway-input.5.scd | ||
| sway-ipc.7.scd | ||
| sway-output.5.scd | ||
| sway.1.scd | ||
| sway.5.scd | ||
| sway_text_node.c | ||
| swaynag.c | ||
| xdg_activation_v1.c | ||
| xdg_decoration.c | ||