swayfxのscratchpadクラッシュを追う: git blameで見つけたupstreamとの噛み合わせ問題

事象 普段使っているswayfx上で、scratchpadに入れたウィンドウを表示している状態からもう一度scratchpad showを叩くと、コンポジタごと丸ごと落ちる現象に遭遇した。SDDMのログイン画面まで戻される、なかなか派手なクラッシュ。 環境: 項目 値 swayfx 0.5.3-4(sway 1.11.0ベース、Arch Linuxパッケージ) wlroots 0.19.3 GPU AMD Radeon RX 6600 XT(amdgpu) bindsymはこう組んでいた: bindsym $mod+minus scratchpad show, resize set width 90 ppt height 90 ppt, move position center Copy scratchpad showと同時にresize・moveを連続実行する形。これを2回続けて押す(1回目で表示、2回目でフォーカスしたまま押してhideパスに入る)とクラッシュする。 スタックトレースを取る coredumpctl + gdb(デバッグシンボル入り)でコアダンプを解析した。 #0 root_scratchpad_hide (con=0x55f058a52400) at ../swayfx-0.5.3/sway/tree/root.c:257 257 set_container_transform(con->pending.workspace, con); seat = 0x55f0580db940 focus = 0x55f058a41760 ws = 0x0 Copy ws(= con->pending.workspace)がNULLのままset_container_transform()に渡され、内部で参照外しして落ちていた。該当箇所のコードはこうなっていた: void root_scratchpad_hide(struct sway_container *con) { struct sway_seat *seat = input_manager_current_seat(); struct sway_node *focus = seat_get_focus_inactive(seat, &root->node); struct sway_workspace *ws = con->pending.workspace; if (con->pending.fullscreen_mode == FULLSCREEN_GLOBAL && !con->pending.workspace) { // If the container was made fullscreen global while in the scratchpad, // it should be shown until fullscreen has been disabled return; } ... set_container_transform(con->pending.workspace, con); // ガードなし Copy NULLチェックが「FULLSCREEN_GLOBALのときだけ」に絞られていて、それ以外の理由でpending.workspaceがNULLになるケースを素通りしてしまう。set_container_transform()はswayfx独自の追加関数(本家swayには存在しない)なので、一見swayfx側のバグに見えた。 ...