Repository navigation
Fix: keep NSStackView arranged subviews in the subview list - #825
Merged
fredkiefer merged 1 commit intoJul 27, 2026
Merged
Conversation
-addArrangedSubview: only appended to the internal arranged list and never made the view a subview, while -arrangedSubviews returned -subviews, so an added view was reported by neither and the count came out wrong. -insertArrangedSubview:atIndex: also skipped the refresh, and -setArrangedSubviews: retained the passed array directly, so a later -addArrangedSubview: mutated a possibly immutable array. -arrangedSubviews now returns the arranged list, and the mutators keep it and the subviews in step to match AppKit: adding or inserting makes the view a subview and deduplicates it, removeArrangedSubview: drops it from the arranged list but leaves it as a subview, and removeFromSuperview drops it from both through -willRemoveSubview:. A plain -addSubview: is a subview but not arranged. The constraint-based layout is a separate change, so the geometry the arranged views get is unchanged here.
fredkiefer
approved these changes
Jul 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
-addArrangedSubview: only appended to the internal arranged list and never made the view a subview, while -arrangedSubviews returned -subviews, so an added view was reported by neither and the count came out wrong. -insertArrangedSubview:atIndex: also skipped the refresh, and -setArrangedSubviews: retained the passed array directly, so a later -addArrangedSubview: could mutate a possibly immutable array.
-arrangedSubviews now returns the arranged list, and the mutators keep it and the subviews in step to match AppKit (checked on a macOS runner):
New Tests/gui/NSStackView/membership.m covers this.
This is the arranged-subview half of #628. The layout half (the custom -_layoutViewsWithOrientation: pass that grows the frame instead of building constraints) needs the constraint solver in #643, so the geometry the arranged views get is unchanged here and the issue stays open for that part.