RFR: 8290844: Add Skin.install() method [v4]
Andy Goryachev
angorya at openjdk.org
Fri Sep 2 21:24:54 UTC 2022
On Thu, 1 Sep 2022 21:52:30 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
> What might help is a concrete example of an application that would hit this bug, and an explanation of how the app would fail.
Let's consider this scenario: an application sets a custom input method on a control, followed by the user loading a new skin via a menu (i.e. after the default skin has been installed).
// 1. control is created
control = new Control();
// 2. user wants to provide a custom input method
control.setInputMethodRequests(USER1);
// 3. Stage.show applies CSS and creates a default skin
control.setInputMethodRequests(SKIN1);
// 4. user loads a new L&F via menu
// 5. new skin is created, constructor sets the control property while the old skin is still attached
new UserSkin(control);
control.setInputMethodRequests(SKIN2);
// 6. user calls setSkin() to install the new skin
oldSkin.dispose()
control.setInputMethodRequests(null); // current implementation
The problem here is that the skin code is unable to decide in step 5 whether to overwrite the input method or keep the current value - because it does not know whether the current value was set by the user (step 2) or the old skin (step 3). Furthermore, if we were to add any kind of conditional logic to step 3 and 5, the problem moves down the line to the dispose(0 method in step 6. since at that moment it is unclear whether the current value was set by the user or by the new skin.
-------------
PR: https://git.openjdk.org/jfx/pull/845
More information about the openjfx-dev
mailing list