File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
test/jdk/java/awt/regtesthelpers Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -1787,8 +1787,20 @@ public Builder position(Position position) {
17871787
17881788 public PassFailJFrame build () throws InterruptedException ,
17891789 InvocationTargetException {
1790- validate ();
1791- return new PassFailJFrame (this );
1790+ try {
1791+ validate ();
1792+ return new PassFailJFrame (this );
1793+ } catch (final Throwable t ) {
1794+ // Dispose of all the windows, including those that may not
1795+ // be registered with PassFailJFrame to allow AWT to shut down
1796+ try {
1797+ invokeOnEDT (() -> Arrays .stream (Window .getWindows ())
1798+ .forEach (Window ::dispose ));
1799+ } catch (Throwable edt ) {
1800+ t .addSuppressed (edt );
1801+ }
1802+ throw t ;
1803+ }
17921804 }
17931805
17941806 /**
You can’t perform that action at this time.
0 commit comments