Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8342928

JavaFX Application Scene nullpoint exception

XMLWordPrintable

      ADDITIONAL SYSTEM INFORMATION :
      linux jdk1.8.0_102

      A DESCRIPTION OF THE PROBLEM :
      2024-10-18 17:02:04:696 [ JavaFX Application Thread:4855526 ] - [ ERROR ] 异常如下:null
      2024-10-18 17:02:04:697 [ JavaFX Application Thread:4855527 ] - [ ERROR ] 详细异常信息:{}
      java.lang.NullPointerException
      at javafx.scene.Scene$ScenePulseListener.synchronizeSceneNodes(Scene.java:2289)
      at javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2419)
      at com.sun.javafx.tk.Toolkit.lambda$runPulse$30(Toolkit.java:355)
      at java.security.AccessController.doPrivileged(Native Method)
      at com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:354)
      at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:381)
      at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:510)
      at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:490)
      at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$404(QuantumToolkit.java:319)
      at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
      at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
      at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
      at java.lang.Thread.run(Thread.java:745)

      REGRESSION : Last worked in version 8u431

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
       private void synchronizeSceneNodes() {
                  Toolkit.getToolkit().checkFxUserThread();

                  Scene.inSynchronizer = true;

                  // if dirtyNodes is null then that means this Scene has not yet been
                  // synchronized, and so we will simply synchronize every node in the
                  // scene and then create the dirty nodes array list
                  if (Scene.this.dirtyNodes == null) {
                      // must do this recursively
                      syncAll(getRoot());
                      dirtyNodes = new Node[MIN_DIRTY_CAPACITY];

                  } else {
                      // This is not the first time this scene has been synchronized,
                      // so we will only synchronize those nodes that need it
                      for (int i = 0 ; i < dirtyNodesSize; ++i) {
                          Node node = dirtyNodes[i];
                          dirtyNodes[i] = null;
                          if (node.getScene() == Scene.this) {
                                  node.impl_syncPeer();
                              }
                          }
                      dirtyNodesSize = 0;
                  }

                  Scene.inSynchronizer = false;
              }

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
       private void synchronizeSceneNodes() {
                  Toolkit.getToolkit().checkFxUserThread();

                  Scene.inSynchronizer = true;

                  // if dirtyNodes is null then that means this Scene has not yet been
                  // synchronized, and so we will simply synchronize every node in the
                  // scene and then create the dirty nodes array list
                  if (Scene.this.dirtyNodes == null) {
                      // must do this recursively
                      syncAll(getRoot());
                      dirtyNodes = new Node[MIN_DIRTY_CAPACITY];

                  } else {
                      // This is not the first time this scene has been synchronized,
                      // so we will only synchronize those nodes that need it
                      for (int i = 0 ; i < dirtyNodesSize; ++i) {
                          Node node = dirtyNodes[i];
                          dirtyNodes[i] = null;
                          if (node.getScene() == Scene.this) {
                                  node.impl_syncPeer();
                              }
                          }
                      dirtyNodesSize = 0;
                  }

                  Scene.inSynchronizer = false;
              }
      ACTUAL -
       private void synchronizeSceneNodes() {
                  Toolkit.getToolkit().checkFxUserThread();

                  Scene.inSynchronizer = true;

                  // if dirtyNodes is null then that means this Scene has not yet been
                  // synchronized, and so we will simply synchronize every node in the
                  // scene and then create the dirty nodes array list
                  if (Scene.this.dirtyNodes == null) {
                      // must do this recursively
                      syncAll(getRoot());
                      dirtyNodes = new Node[MIN_DIRTY_CAPACITY];

                  } else {
                      // This is not the first time this scene has been synchronized,
                      // so we will only synchronize those nodes that need it
                      for (int i = 0 ; i < dirtyNodesSize; ++i) {
                          Node node = dirtyNodes[i];
                          dirtyNodes[i] = null;
                          if (node.getScene() == Scene.this) {
                                  node.impl_syncPeer();
                              }
                          }
                      dirtyNodesSize = 0;
                  }

                  Scene.inSynchronizer = false;
              }

      ---------- BEGIN SOURCE ----------
       
      private void synchronizeSceneNodes() {
                  Toolkit.getToolkit().checkFxUserThread();

                  Scene.inSynchronizer = true;

                  // if dirtyNodes is null then that means this Scene has not yet been
                  // synchronized, and so we will simply synchronize every node in the
                  // scene and then create the dirty nodes array list
                  if (Scene.this.dirtyNodes == null) {
                      // must do this recursively
                      syncAll(getRoot());
                      dirtyNodes = new Node[MIN_DIRTY_CAPACITY];

                  } else {
                      // This is not the first time this scene has been synchronized,
                      // so we will only synchronize those nodes that need it
                      for (int i = 0 ; i < dirtyNodesSize; ++i) {
                          Node node = dirtyNodes[i];
                          dirtyNodes[i] = null;
                          if (node.getScene() == Scene.this) {
                                  node.impl_syncPeer();
                              }
                          }
                      dirtyNodesSize = 0;
                  }
                  Scene.inSynchronizer = false;
              }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
       private void synchronizeSceneNodes() {
                  Toolkit.getToolkit().checkFxUserThread();

                  Scene.inSynchronizer = true;

                  // if dirtyNodes is null then that means this Scene has not yet been
                  // synchronized, and so we will simply synchronize every node in the
                  // scene and then create the dirty nodes array list
                  if (Scene.this.dirtyNodes == null) {
                      // must do this recursively
                      syncAll(getRoot());
                      dirtyNodes = new Node[MIN_DIRTY_CAPACITY];

                  } else {
                      // This is not the first time this scene has been synchronized,
                      // so we will only synchronize those nodes that need it
                      for (int i = 0 ; i < dirtyNodesSize; ++i) {
                          Node node = dirtyNodes[i];
                          dirtyNodes[i] = null;
                          if (node.getScene() == Scene.this) {
                                  node.impl_syncPeer();
                              }
                          }
                      dirtyNodesSize = 0;
                  }

                  Scene.inSynchronizer = false;
              }

      FREQUENCY : rarely


            adev Anupam Dev
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: