szn

Bug 413 — cmdJoinPane error path strands panes after ownership moved, violating the bug-#287 invariant it cites

413. cmdJoinPane error path strands panes after ownership moved, violating the bug-#287 invariant it cites

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:

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.