<Swing Dev> RFR: 4907798: MEMORY LEAK: javax.swing.plaf.basic.BasicPopupMenuUI$MenuKeyboardHelper [v2]
Sergey Bylokhov
serb at openjdk.java.net
Tue Nov 10 02:50:54 UTC 2020
On Mon, 9 Nov 2020 23:25:13 GMT, Alexander Zuev <kizune at openjdk.org> wrote:
>> I meant this code at the start of the method:
>> ` if (!(UIManager.getLookAndFeel() instanceof BasicLookAndFeel)) {
>> uninstall();
>> return;
>> }`
>> If "uninstall" will not solve the problem and the code added in this fix will not be executed, then we will get the same leak?
>
> The code block here with uninstall is called if currently installed LAF is not derived from BasicLAF in which case we will not have this problem in the first place - the only place where we are setting menuInputMap variable is in this method down the line so it never gets initialized. And no, calling uninstall() unconditionally will not solve the problem because uninstall() does not change this value either.
I guess that the uninstall() above is called when the L&F was basic(since BasicPopupMenuUI is used) and then changed for some reason, so when the method in the BasicPopupMenuUI.java will be called we will find that the current L&F is different and call "uninstall()", so this is my question: will the leak will exist in that case? I mean the code changed by the current fix will not be executed since we will exit after "uninstall()".
-------------
PR: https://git.openjdk.java.net/jdk/pull/1035
More information about the swing-dev
mailing list