diff --git a/.hgtags b/.hgtags index 62768ebbc2da45542b844e257bbbb07fbafd93eb..ee8cae8dfd032608cc3daba9f56c787ae5530a7a 100644 --- a/.hgtags +++ b/.hgtags @@ -635,6 +635,7 @@ de1d09f09e571e38afdf1fb72984ec210e7c19e6 jdk8u111-b02 710f0c95444deb36b422f449f422d925a72f6b2c jdk8u111-b04 d689f7b806c89e535f784ba94bea1ae129ee0f19 jdk8u111-b05 6c822cce832523a5aee9632e28065f0c302187ed jdk8u111-b06 +1afe84012d643b4092dbf25f1cbb761508c19ed2 jdk8u111-b07 47e20a90bdbb2327289e330606b73a9fe4dc857e jdk8u112-b00 96393e490afd4acba5b92c5ede68dc9bbb60a38e jdk8u112-b01 b44d695f738baba091370828b84ae2c4cd715c1b jdk8u112-b02 diff --git a/src/windows/classes/sun/awt/windows/WFramePeer.java b/src/windows/classes/sun/awt/windows/WFramePeer.java index 37486e18ebac150e5c035c26a78ebaea7b6de535..6140c2cd95adb85ba38deeb648fe005d8611eb0e 100644 --- a/src/windows/classes/sun/awt/windows/WFramePeer.java +++ b/src/windows/classes/sun/awt/windows/WFramePeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -153,6 +153,19 @@ class WFramePeer extends WWindowPeer implements FramePeer { @Override public void setMenuBar(MenuBar mb) { WMenuBarPeer mbPeer = (WMenuBarPeer) WToolkit.targetToPeer(mb); + if (mbPeer != null) { + if (mbPeer.framePeer != this) { + mb.removeNotify(); + mb.addNotify(); + mbPeer = (WMenuBarPeer) WToolkit.targetToPeer(mb); + if (mbPeer != null && mbPeer.framePeer != this) { + throw new IllegalStateException("Wrong parent peer"); + } + } + if (mbPeer != null) { + addChildPeer(mbPeer); + } + } setMenuBar0(mbPeer); updateInsets(insets_); } diff --git a/src/windows/classes/sun/awt/windows/WMenuBarPeer.java b/src/windows/classes/sun/awt/windows/WMenuBarPeer.java index 3a661da6a3aa257deb22222dd3050ff920ccef51..9c68e715192353e8661e376e61cd2ea22d45588b 100644 --- a/src/windows/classes/sun/awt/windows/WMenuBarPeer.java +++ b/src/windows/classes/sun/awt/windows/WMenuBarPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,6 +31,8 @@ final class WMenuBarPeer extends WMenuPeer implements MenuBarPeer { // MenuBarPeer implementation + final WFramePeer framePeer; + @Override public native void addMenu(Menu m); @Override @@ -44,8 +46,11 @@ final class WMenuBarPeer extends WMenuPeer implements MenuBarPeer { // Toolkit & peer internals WMenuBarPeer(MenuBar target) { this.target = target; - WFramePeer framePeer = (WFramePeer) + framePeer = (WFramePeer) WToolkit.targetToPeer(target.getParent()); + if (framePeer != null) { + framePeer.addChildPeer(this); + } create(framePeer); // fix for 5088782: check if menu object is created successfully checkMenuCreation();