RFR: 8290990: Clear .root style class from a root node that is removed from a Scene/SubScene

Marius Hanl mhanl at openjdk.org
Thu Jul 28 09:44:59 UTC 2022


On Tue, 26 Jul 2022 02:46:15 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:

> When a node is set as the root node of a `Scene` or `SubScene`, the "root" style class is automatically added to the node, but not cleared when the node is later removed from the scene.
> 
> This can lead to an incorrectly set "root" style class when the removed node is inserted in the scene graph below the root node, or to duplicate "root" style class entries when the removed node is again set as the root node of the scene.

Looks good to me too.

modules/javafx.graphics/src/main/java/javafx/scene/SubScene.java line 317:

> 315: 
> 316:                     if (oldRoot != null) {
> 317:                         StyleManager.getInstance().forget(SubScene.this);

Not part of the story, but interesting that here the `SubScene` will be 'forgotten' but nothing like this happens in the `Scene` class. 😄

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

Marked as reviewed by mhanl (Author).

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


More information about the openjfx-dev mailing list