[Rev 04] RFR: 8236259: MemoryLeak in ProgressIndicator

Kevin Rushforth kcr at openjdk.java.net
Wed Mar 11 12:53:26 UTC 2020


On Wed, 11 Mar 2020 12:43:40 GMT, Ambarish Rapte <arapte at openjdk.org> wrote:

>> Florian Kirmaier has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   JDK-8200224
>>   cleaned up code based on code review
>
> modules/javafx.controls/src/main/java/javafx/scene/control/skin/ProgressIndicatorSkin.java line 550:
> 
>> 549:         }
>> 550:
>> 551:         private void setFillOverride(Paint fillOverride) {
> 
> The issue can be alternatively fixed using below change at line#510
>             text.fontProperty().addListener(new WeakChangeListener<>((observable, oldValue, newValue) -> {
>                 doneTextWidth = Utils.computeTextWidth(text.getFont(), DONE, 0);
>                 doneTextHeight = Utils.computeTextHeight(text.getFont(), DONE, 0, TextBoundsType.LOGICAL_VERTICAL_CENTER);
>             }));
> 
> I am not sure which one is better.
> As there are no objections, I am good with the any.

Nope. This won't work, since the listener will be garbage collected and stop being called. It could be done by keeping
the listener is an instance variable, but I recommend the original fix.

-------------

PR: https://git.openjdk.java.net/jfx/pull/71


More information about the openjfx-dev mailing list