RFR: 8255248: NullPointerException in JFXPanel due to race condition in HostContainer [v3]
Prasanta Sadhukhan
psadhukhan at openjdk.org
Mon Jul 24 07:02:03 UTC 2023
On Fri, 21 Jul 2023 21:45:56 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:
>> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Check FXEnabled initially
>
> modules/javafx.swing/src/main/java/javafx/embed/swing/JFXPanel.java line 1069:
>
>> 1067:
>> 1068: @Override
>> 1069: public void setEmbeddedScene(EmbeddedSceneInterface embeddedScene) {
>
> Same comment as with `setEmbeddedStage`; surrounding all accesses to `scenePeer` and `stagePeer` like this is not the way to do it, and looks incorrect. I think this is more in the right direction:
>
> public void setEmbeddedScene(EmbeddedSceneInterface embeddedScene) {
> synchronized(LOCK) {
> if (scenePeer == embeddedScene) {
> return;
> }
> scenePeer = embeddedScene;
> }
>
> if (embeddedScene == null) {
> invokeOnClientEDT(() -> {
> if (dnd != null) {
> dnd.removeNotify();
> dnd = null;
> }
> });
> return;
> }
> if (pWidth > 0 && pHeight > 0) {
> embeddedScene.setSize(pWidth, pHeight);
> }
> embeddedScene.setPixelScaleFactors((float) scaleFactorX, (float) scaleFactorY);
>
> invokeOnClientEDT(() -> {
> dnd = new SwingDnD(JFXPanel.this, scenePeer);
> dnd.addNotify();
> embeddedScene.setDragStartListener(dnd.getDragStartListener());
> });
> }
ok
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1178#discussion_r1271826532
More information about the openjfx-dev
mailing list