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).

Good catch indeed. One question inline.

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

> 67:             case WindowEvent.MAXIMIZE:
> 68:                 listener.changedIconified(false);
> 69:                 listener.changedMaximized(true);

If I understand this correctly, the following sequence will happen: 
1. iconfied state
2. listener will be nulled because we `hide()` the stage
3. we still change / deliver the maxiimized state to the stage that otherwise 
has no listener anymore

I don't think this is a problem. But I still want to bring this up -- does this 
make sense / no harm in doing that?
Otherwise we need to null check every second `changeXYZ` call.

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

Marked as reviewed by mhanl (Reviewer).

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

Reply via email to