Severity: MEDIUM Status: ✅ RESOLVED
The #287 comment above this block asserts “every fallible step runs BEFORE ownership of sp changes” — but findLeafParent(...) orelse { dummy_pane.deinit(); return .err; } (:416-419) runs after src_win.extractPane(...) (:407) and possibly after session.killWindow(src_win) (:409-414). On that error:
sp is in no window’s list, yet its pty is live (fd still polled) and sp.window points into the killed window;dummy_pane remains registered in dst_win.panes/layout — the next resize/render/killWindow path walks into a deinited screen.The sibling rollback at :397 correctly calls undoSplit; this branch does not undo anything.
Fix: hoist the findLeafParent lookup before extractPane, or roll back (undoSplit + re-insert sp) on failure.