提交 009857ba 编写于 作者: S ssadetsky

8161141: correct bugId for JDK-8158994 fix push

Reviewed-by: prr, mschoene
上级 d5fdf789
/* /*
* Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -107,7 +107,6 @@ class WMenuItemPeer extends WObjectPeer implements MenuItemPeer { ...@@ -107,7 +107,6 @@ class WMenuItemPeer extends WObjectPeer implements MenuItemPeer {
this.target = target; this.target = target;
this.parent = (WMenuPeer) WToolkit.targetToPeer(target.getParent()); this.parent = (WMenuPeer) WToolkit.targetToPeer(target.getParent());
this.isCheckbox = isCheckbox; this.isCheckbox = isCheckbox;
parent.addChildPeer(this);
create(parent); create(parent);
// fix for 5088782: check if menu object is created successfully // fix for 5088782: check if menu object is created successfully
checkMenuCreation(); checkMenuCreation();
......
/* /*
* Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -51,12 +51,10 @@ class WMenuPeer extends WMenuItemPeer implements MenuPeer { ...@@ -51,12 +51,10 @@ class WMenuPeer extends WMenuItemPeer implements MenuPeer {
if (parent instanceof MenuBar) { if (parent instanceof MenuBar) {
WMenuBarPeer mbPeer = (WMenuBarPeer) WToolkit.targetToPeer(parent); WMenuBarPeer mbPeer = (WMenuBarPeer) WToolkit.targetToPeer(parent);
this.parent = mbPeer; this.parent = mbPeer;
mbPeer.addChildPeer(this);
createMenu(mbPeer); createMenu(mbPeer);
} }
else if (parent instanceof Menu) { else if (parent instanceof Menu) {
this.parent = (WMenuPeer) WToolkit.targetToPeer(parent); this.parent = (WMenuPeer) WToolkit.targetToPeer(parent);
this.parent.addChildPeer(this);
createSubMenu(this.parent); createSubMenu(this.parent);
} }
else { else {
......
/* /*
* Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -24,9 +24,6 @@ ...@@ -24,9 +24,6 @@
*/ */
package sun.awt.windows; package sun.awt.windows;
import java.util.Map;
import java.util.WeakHashMap;
abstract class WObjectPeer { abstract class WObjectPeer {
static { static {
...@@ -48,8 +45,6 @@ abstract class WObjectPeer { ...@@ -48,8 +45,6 @@ abstract class WObjectPeer {
// used to synchronize the state of this peer // used to synchronize the state of this peer
private final Object stateLock = new Object(); private final Object stateLock = new Object();
private volatile Map<WObjectPeer, WObjectPeer> childPeers;
public static WObjectPeer getPeerForTarget(Object t) { public static WObjectPeer getPeerForTarget(Object t) {
WObjectPeer peer = (WObjectPeer) WToolkit.targetToPeer(t); WObjectPeer peer = (WObjectPeer) WToolkit.targetToPeer(t);
return peer; return peer;
...@@ -82,9 +77,6 @@ abstract class WObjectPeer { ...@@ -82,9 +77,6 @@ abstract class WObjectPeer {
} }
if (call_disposeImpl) { if (call_disposeImpl) {
if (childPeers != null) {
disposeChildPeers();
}
disposeImpl(); disposeImpl();
} }
} }
...@@ -96,33 +88,4 @@ abstract class WObjectPeer { ...@@ -96,33 +88,4 @@ abstract class WObjectPeer {
* Initialize JNI field and method IDs * Initialize JNI field and method IDs
*/ */
private static native void initIDs(); private static native void initIDs();
// if a child peer existence depends on this peer, add it to this collection
final void addChildPeer(WObjectPeer child) {
synchronized (getStateLock()) {
if (childPeers == null) {
childPeers = new WeakHashMap<>();
}
if (isDisposed()) {
throw new IllegalStateException("Parent peer is disposed");
}
childPeers.put(child, this);
}
}
// called to dispose dependent child peers
private void disposeChildPeers() {
synchronized (getStateLock()) {
for (WObjectPeer child : childPeers.keySet()) {
if (child != null) {
try {
child.dispose();
}
catch (Exception e) {
// ignored
}
}
}
}
}
} }
/* /*
* Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -58,7 +58,6 @@ final class WPopupMenuPeer extends WMenuPeer implements PopupMenuPeer { ...@@ -58,7 +58,6 @@ final class WPopupMenuPeer extends WMenuPeer implements PopupMenuPeer {
parent = WToolkit.getNativeContainer((Component)parent); parent = WToolkit.getNativeContainer((Component)parent);
parentPeer = (WComponentPeer) WToolkit.targetToPeer(parent); parentPeer = (WComponentPeer) WToolkit.targetToPeer(parent);
} }
parentPeer.addChildPeer(this);
createMenu(parentPeer); createMenu(parentPeer);
// fix for 5088782: check if menu object is created successfully // fix for 5088782: check if menu object is created successfully
checkMenuCreation(); checkMenuCreation();
......
/* /*
* Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -1113,19 +1113,11 @@ AwtMenuBar* AwtFrame::GetMenuBar() ...@@ -1113,19 +1113,11 @@ AwtMenuBar* AwtFrame::GetMenuBar()
void AwtFrame::SetMenuBar(AwtMenuBar* mb) void AwtFrame::SetMenuBar(AwtMenuBar* mb)
{ {
if (menuBar) {
menuBar->SetFrame(NULL);
}
menuBar = mb; menuBar = mb;
if (mb == NULL) { if (mb == NULL) {
// Remove existing menu bar, if any. // Remove existing menu bar, if any.
::SetMenu(GetHWnd(), NULL); ::SetMenu(GetHWnd(), NULL);
} else { } else {
AwtFrame* oldFrame = menuBar->GetFrame();
if (oldFrame && oldFrame != this) {
oldFrame->SetMenuBar(NULL);
}
menuBar->SetFrame(this);
if (menuBar->GetHMenu() != NULL) { if (menuBar->GetHMenu() != NULL) {
::SetMenu(GetHWnd(), menuBar->GetHMenu()); ::SetMenu(GetHWnd(), menuBar->GetHMenu());
} }
......
/* /*
* Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -58,9 +58,6 @@ AwtMenuBar::~AwtMenuBar() ...@@ -58,9 +58,6 @@ AwtMenuBar::~AwtMenuBar()
void AwtMenuBar::Dispose() void AwtMenuBar::Dispose()
{ {
if (m_frame != NULL && m_frame->GetMenuBar() == this) {
m_frame->SetMenuBar(NULL);
}
m_frame = NULL; m_frame = NULL;
AwtMenu::Dispose(); AwtMenu::Dispose();
......
/* /*
* Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -63,9 +63,6 @@ public: ...@@ -63,9 +63,6 @@ public:
virtual AwtMenuBar* GetMenuBar() { return this; } virtual AwtMenuBar* GetMenuBar() { return this; }
INLINE AwtFrame* GetFrame() { return m_frame; } INLINE AwtFrame* GetFrame() { return m_frame; }
INLINE void SetFrame(AwtFrame* frame) {
m_frame = frame;
}
virtual HWND GetOwnerHWnd(); virtual HWND GetOwnerHWnd();
virtual void RedrawMenuBar(); virtual void RedrawMenuBar();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册