The fix looks good to me.
Thanks,
Alexandr.
On 7/20/2016 11:37 AM, Robin Stevens wrote:
Hello,
please review this patch for issue JDK-8161664:
Bug: https://bugs.openjdk.java.net/browse/JDK-8161664
Patch: http://cr.openjdk.java.net/~rstevens/8161664/webrev.00/
<http://cr.openjdk.java.net/%7Erstevens/8161664/webrev.00/>
The problem is that in certain scenarios, the Timer in the Animator of
the AquaProgressBarUI does not get stopped when the progress bar is
removed from the Swing hierarchy.
Several approaches were discussed in another thread
(http://mail.openjdk.java.net/pipermail/swing-dev/2016-July/006330.html).
In the linked webrev, I opted to use the same approach as what is done
in the BasicProgressBarUI class: only start the timer when the
progress bar is displayable.
To achieve this, I wrapped all calls to startAnimationTimer with an if
statement that checks the displayable state of the progress bar.
There is one call to startAnimationTimer that is not adjusted. That
call is only triggered from the paint method, which in turn is only
triggered if the progress bar is displayable. As such, the if check
was not needed there (imo).
The patch includes a test, which fails without the fix and succeeds
afterwards.
Thanks,
Robin