Two problems in NSStackView beyond the state fixes in the linked PRs.
Arranged subviews: after -addArrangedSubview: on a plain -initWithFrame: stack view, -arrangedSubviews does not reliably report the added views and they are not left in -subviews as AppKit leaves them. The count comes out wrong, so membership cannot be relied on.
Layout: -_layoutViewsWithOrientation: is a custom pass that grows the stack view's own frame and positions the subviews by a running offset. It does not consult the distribution or alignment, and it does not build layout constraints, so the arranged geometry does not match AppKit's constraint-based model. Matching AppKit here would need a constraint-based rewrite rather than a small fix.
The scalar-state crash and default divergences are handled separately (empty-view setter crash and the initializer defaults).
Two problems in NSStackView beyond the state fixes in the linked PRs.
Arranged subviews: after -addArrangedSubview: on a plain -initWithFrame: stack view, -arrangedSubviews does not reliably report the added views and they are not left in -subviews as AppKit leaves them. The count comes out wrong, so membership cannot be relied on.
Layout: -_layoutViewsWithOrientation: is a custom pass that grows the stack view's own frame and positions the subviews by a running offset. It does not consult the distribution or alignment, and it does not build layout constraints, so the arranged geometry does not match AppKit's constraint-based model. Matching AppKit here would need a constraint-based rewrite rather than a small fix.
The scalar-state crash and default divergences are handled separately (empty-view setter crash and the initializer defaults).