szn

Bug 365 — killWindow leaves dead fds registered in the event loop

365. Twin of #364 on the kill-window path

File: src/session.zig:99-117 (reachable via cmdKillWindow, cmd.zig:107-120, and break/join-pane rollback) Severity: MEDIUM Status: ✅ FIXED

Fix (applied)

New Server.unregisterWindowFds(win) removes every pty master of the window from the poll set; it is called before Session.killWindow at all command entry points (new-window rollback, both kill-window branches, and join-pane’s source-window drop). Session stays decoupled from the loop.

Test: kill-window removes pane ptys from the poll set — bug #365 (two windows with fake ptys registered; after kill-window 1 only window 1’s fd remains watched).

Problem

killWindow deinits panes — closing pty masters — but never removes them from the poll set. Consequences:

Fix (proposed)

Give Session/killWindow access to the loop (or return closed masters to the caller) so each pty master is removed before close, mirroring destroyPane’s pattern at server.zig:828-830.