Repository navigation
Make adding an existing MultiProgress member a no-op - #854
Merged
chris-laplante merged 1 commit intoNov 5, 2026
Merged
Conversation
djc
approved these changes
Oct 26, 2026
djc
left a comment
Member
There was a problem hiding this comment.
Makes sense to me -- @chris-laplante thoughts?
Collaborator
Yes, agreed! Sorry for the delay, I was on vacation. |
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.
The docs on
MultiProgress::addand theinsert*methods say that adding a bar that is already a member has no effect (#503), butinternalize()always allocates a new slot, so the bar moves and its old slot is never freed. If that slot is first in the ordering, finished bars are never pruned and a dropped bar keeps being redrawn (two spinners with a{msg}template):This returns early from
internalize()when the bar already belongs to thisMultiProgress, using the sameArc::ptr_eqcheck asremove(). Soinsert(0, pb)on an existing member no longer moves it, which matches the docs.The new
mp_double_add_is_nooptest fails on main (5 members instead of 2). Tests pass with all, default and no default features; fmt, clippy and doc are clean.