On Tue, 27 Sep 2022 19:36:46 GMT, Andy Goryachev <[email protected]> wrote:

> Using new Skin.install() method to properly install and uninstall 
> inputMethodTextChanged and inputMethodRequests properties on TextInputControl.
> 
> This avoids memory leaks resulting from skin change, as well as honors 
> user-set properties when installing an uninstalling.
> 
> This PR depends on [JDK-8290844](https://bugs.openjdk.org/browse/JDK-8290844) 
> Skin.install().

modules/javafx.controls/src/main/java/javafx/scene/control/skin/TextInputControlSkin.java
 line 340:

> 338:             
> control.setOnInputMethodTextChanged(inputMethodTextChangedHandler);
> 339:         }
> 340: 

for the record: this pattern is incorrect (no matter _where_ the skin 
implements it ;) - a skin should not set a singleton event handler on its 
control (see [JDK-8093590](https://bugs.openjdk.org/browse/JDK-8093590)).

Not sure how we should procede in this case: moving to install fixes the issue 
on face value (not overwriting a user-installed handler) but not the incorrect 
handler registration (should be replaced by an added listener as done in the 
fix of JDK-8093590) - the latter could be done in a follow-up issue, adding a 
code comment here?

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

PR: https://git.openjdk.org/jfx/pull/903

Reply via email to