On Sat, 19 Feb 2022 17:40:54 GMT, delvh <d...@openjdk.java.net> wrote:

>> If the InputMethod's node is not in the scene, the default text location 
>> point is returned.
>
> modules/javafx.controls/src/main/java/javafx/scene/control/skin/TextInputControlSkin.java
>  line 340:
> 
>> 338:                 if (window == null) {
>> 339:                     return new Point2D(0, 0);
>> 340:                 }
> 
> As long as each scene needs to be located in a window, the following will 
> simplify the code:
> Suggestion:
> 
>                 if (scene == null) {
>                     return new Point2D(0, 0);
>                 }
>                 Window window = scene.getWindow();
> 
> Is it possible to have a scene without an assigned window?

Since the NullPointer occurs here because the synchronization between JavaFx 
and AWT threads is not really possible in this case, we cannot ensure that this 
method is only called when the scene is assigned to a window.
I would check here for null both the scene and the window.

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

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

Reply via email to