Bug: https://bugs.openjdk.java.net/browse/JDK-8196322 <https://bugs.openjdk.java.net/browse/JDK-8196322> webrev: http://cr.openjdk.java.net/~serb/alans/8196322/webrev.00/ <http://cr.openjdk.java.net/~serb/alans/8196322/webrev.00/>
When a default menu bar is set and the screen menu bar is in use, a heavyweight ScreenMenuBar is created to manage the connection to the native application menu bar and addNotify() is called to create peers. The peers are registered and they prevent AWT shutdown from happening. If the default menu bar is removed, by setting it to null, removeNotify() is not called, so the peers remain registered and AWT shutdown is still prevented. The change is to call removeNotify when the current default menu bar is replaced, either by null or a different menu bar.