Adding, then removing, and then adding a JFXPanel to the same component in the 
Swing scene graph leads to a NullPointerException in GlassScene because the 
sceneState is null.
Removing JFXPanel calls JFXPanel.removeNotify which calls Window.hide which 
calls SceneHelper.disposePeer -> Scene.disposePeer -> EmbeddedScene.dispose -> 
GlassScene.dispose which sets "sceneState" to null...
so when GlassScene.updateSceneState is called, it results in NPE.
Fix is to check if `host` (which is usually 
javafx.embed.swing.JFXPanel$HostContainer for active JFXPanel) has been 
reset/deleted which is done when `EmbeddedScene.dispose` is called during 
removeNotify and abstain from updating the scene state

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

Commit messages:
 - 8334593: Adding, removing and then adding a JFXPanel again leads to 
NullPointerException

Changes: https://git.openjdk.org/jfx/pull/1493/files
  Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=1493&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8334593
  Stats: 3 lines in 1 file changed: 2 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jfx/pull/1493.diff
  Fetch: git fetch https://git.openjdk.org/jfx.git pull/1493/head:pull/1493

PR: https://git.openjdk.org/jfx/pull/1493

Reply via email to