Skip to content

Prevent getSliderRenderer w/h side-effects from leaking out of getPainter#14

Open
karlvr wants to merge 1 commit intovioletlib:masterfrom
karlvr:fix/slider-wh-leakage
Open

Prevent getSliderRenderer w/h side-effects from leaking out of getPainter#14
karlvr wants to merge 1 commit intovioletlib:masterfrom
karlvr:fix/slider-wh-leakage

Conversation

@karlvr
Copy link
Copy Markdown

@karlvr karlvr commented Mar 17, 2026

getSliderRenderer() intentionally modifies the instance w/h fields so that configureLayout() uses the adjusted dimensions for the slider. However, these modified values persisted after getPainter() returned. Save and restore w/h around the call to prevent state leakage.

In practice I don't think this creates a problem as configure(w, h) is always called first, but maybe you'll agree it's nice to tidy up. In this PR: it is a bit weird that the save/restore is in a different method (and class) to the mutation, but it is the best approach I came up with.

…nter

getSliderRenderer() intentionally modifies the instance w/h fields so
that configureLayout() uses the adjusted dimensions for the slider.
However, these modified values persisted after getPainter() returned.
Save and restore w/h around the call to prevent state leakage.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant