On Mon, 9 Nov 2026 16:10:33 GMT, Christopher Schnick <[email protected]> 
wrote:

> This PR fixes some rare NPEs I saw some users encounter when a window was 
> hidden. The tests should cover all those potential issues and should fail 
> without this PR and succeed with this PR.
> 
> I originally only wanted to fix the 1. NPE because that actually happened to 
> some users, but during that I realized that the 2. NPE can also be provoked 
> if you write a listener that just hides the window on some window events.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

looks like a good idea

modules/javafx.graphics/src/main/java/com/sun/javafx/tk/quantum/GlassWindowEventHandler.java
 line 58:

> 56:         // Read the listener once as it can be cleared while this event is
> 57:         // being processed, e.g. if an application listener hides the 
> stage
> 58:         TKStageListener listener = stage.stageListener;

should the same treatment (a local var) be applied to GlassStage:173 ?

also, do we know whether `GlassStage.stageListener` is accessed from multiple 
threads and therefore be declared `volatile`?

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

PR Review: https://git.openjdk.org/jfx/pull/2364#pullrequestreview-5829122893
PR Review Comment: https://git.openjdk.org/jfx/pull/2364#discussion_r4515234463

Reply via email to