Issue #593: add regression test for cursor leak and stale tooltip on live charts#1012
Merged
Merged
Conversation
The cursor's memory leak and stale tooltip on live charts were both fixed by the two-phase PlotInteractionData refactor, but nothing guarded against a regression. Add a headless test covering both symptoms across repeated live updates: the point lists must not grow, and the label must reflect the current frame. Also fix stale javadoc in TestForIssue593 that referenced a cursor.clearDataPoints() method that no longer exists. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Closes #593.
Analysis
Both symptoms reported in #593 had a single cause:
Cursorheld adataPointListof screen-space points that was appended to on every repaint and never cleared.Cursor$DataPoint".Both were already fixed as a side effect of the two-phase
PlotInteractionDatarefactor, not by a targeted fix. Interaction data is now cleared at the start of each paint inPlotContent_.paint(), andCursor.setData()rebuilds its own list from it. Nothing guarded against a regression, hence this PR.Changes
CursorLiveChartTest— two tests over 30 live updates: one asserts the point lists stay bounded (leak), one asserts the label reflects the current frame (stale tooltip). Headless, noXChartPanel, following the existingCursorZoomTestpattern.Cursor.dataPointListpackage-private so the test can assert on it.TestForIssue593that referenced acursor.clearDataPoints()method that no longer exists.Verification
Confirmed the test is a genuine regression test by temporarily removing
dataPointList.clear()— it fails with exactly the reported symptoms:Fix restored; full
xchartsuite passes andxchart-democompiles.🤖 Generated with Claude Code