RFR: JDK-8298104: NPE on synchronizeSceneNodes()

John Hendrikx jhendrikx at openjdk.org
Fri Dec 22 10:40:51 UTC 2023


On Wed, 3 May 2023 11:46:50 GMT, Daniel <duke at openjdk.org> wrote:

> A null pointer exception occurs on the ScenePulseListener when iterating through the dirty node list.
> A null check is needed on the node before calling node.getScene().
> 
> The error occurs occasionally and causes the application to crash.
> 
> Issue: [JDK-8298104: NPE on synchronizeSceneNodes()](https://bugs.openjdk.org/browse/JDK-8298104)

If you are not using modules, you don't need to compile javafx.graphics to attempt to analyze the problem.  You can include a copy of `Scene` with your sources (making sure that it is in the original package `javafx.scene`) to debug this further.

If you can reproduce this problem in a small program that you can share, we can try and find out why there is a NPE there -- if only a single thread is using the `dirtyNodes` array, I don't think there can be a `null` in there, but perhaps there is a mistake in the code.

As noted before, a possible cause of this problem is accessing FX components that are currently part of the Scene graph on the wrong thread.  This is not allowed, and such accesses must be wrapped in `Platform::runLater`.  I realize that in a large application it might be hard to find what is doing this, but if you have multiple threads, then inspect if any thread is accessing FX components (like `Node`s, `Timeline`s, etc) directly.  Not all such calls will inform you of problems, so assuming that a call is allowed because you didn't get an exception is incorrect.

edit: feel free to contact me more directly (gmail john.hendrikx)

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

PR Comment: https://git.openjdk.org/jfx/pull/1123#issuecomment-1867524649


More information about the openjfx-dev mailing list