I did notice the inner classes are not static, but this is the same as
the class from which they were copied and it seems like they need
access to the enclosing instance.

Can you expand on the path to the problem you see ?

I don't think you will have a memory leak due to multiple calls to installListeners()
which is how I read your statement. That would suggest you are talking about
the SelectNextBtn instance leaking ?

First, the reference is one-way. Once the map entry is over-written, the previous SelectNextBtn() instance will become eligible to be gc'd since there will be nothing
referencing it. Marginally inefficient, but that is all I see.

But what about just the single call to installListeners() ? And if you mean the RadioButtonUI will leak ? Multiple calls to installListeners() won't affect that so far as I can see. So long as uninstallListeners() is called then the map entry will be cleared, making the values referenced eligible for GC, in turn making the RadioButtonUI eligible for GC - which probably will typically happen only if the app switches L&F so that is rare.

So I think there is only a bug if uninstallListeners() is not called, and I presume
there has to be a pattern to make sure this happens across Swing ...

-phil.

On 8/12/18, 9:13 AM, Prasanta Sadhukhan wrote:

One thing from 1st look...

Every time installListeners is called, it instantiates SelectPreviousBtn and SelectNextBtn which is a inner class (and not a static class) and it has a strong reference to AquaButtonRadioUI so it may not be garbage collected and can cause a leak.

Regards
Prasanta
On 8/11/2018 8:51 PM, Krishna Addepalli wrote:

Hi All,

Please review a fix for JDK-8208640: https://bugs.openjdk.java.net/browse/JDK-8208640

Webrev: http://cr.openjdk.java.net/~kaddepalli/8208640/webrev00/ <http://cr.openjdk.java.net/%7Ekaddepalli/8208640/webrev00/>

The problem is that the arrow key navigation for Aqua L&F was not implemented, which is why neither the tab keys nor the arrow keys were allowing to navigate through the radio buttons through a button group.

Proposed fix is to copy the implementation from Basic L&F into Aqua L&F. Also fixed the test that was written to include the Aqua L&F to be tested, and it passes on Mac successfully.

Thanks,

Krishna


Reply via email to