On Mon, 6 Jul 2026 13:03:31 GMT, Jose Pereda <[email protected]> wrote:
> This PR removes the stage from the active windows list after a destroy > notification, preventing a possible NPE in `WindowStage::setIconified`. > > A system test that fails before the proposed fix, and passes after it, has > been included. > > --------- > - [X] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai). modules/javafx.graphics/src/main/java/com/sun/javafx/tk/quantum/GlassWindowEventHandler.java line 136: > 134: case WindowEvent.DESTROY: > 135: stage.setPlatformWindowClosed(); > 136: WindowStage.removeActiveWindow(stage); The fix seems to be working (tested on macOS and windows). One peculiar thing I noticed is that if I set a breakpoint in WindowStage:582 in the the master branch and run the test hitting the breakpoint, it won't fail in macOS (but fails in windows). The main question is why `removeActiveWindow()` is called before the `stage.stageListener.closed()`, somehow it does not seem right. I wonder if the order should have been case WindowEvent.DESTROY: stage.stageListener.closed(); stage.setPlatformWindowClosed(); In fact, the test passes in this case without needing `removeActiveWindow()`, as it's being called inside `stage.stageListener.closed();` What do you think about that? ------------- PR Review Comment: https://git.openjdk.org/jfx/pull/2202#discussion_r3530903582
