mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 10:04:42 +02:00
8189204: Possible NPE in Component::getLocationOnScreen()
Reviewed-by: serb, prr
This commit is contained in:
parent
e27e8b9e39
commit
48508135fe
2 changed files with 62 additions and 2 deletions
|
@ -2039,14 +2039,14 @@ public abstract class Component implements ImageObserver, MenuContainer,
|
|||
* used by GlobalCursormanager to update cursor
|
||||
*/
|
||||
final Point getLocationOnScreen_NoTreeLock() {
|
||||
|
||||
ComponentPeer peer = this.peer;
|
||||
if (peer != null && isShowing()) {
|
||||
if (peer instanceof LightweightPeer) {
|
||||
// lightweight component location needs to be translated
|
||||
// relative to a native component.
|
||||
Container host = getNativeContainer();
|
||||
Point pt = host.peer.getLocationOnScreen();
|
||||
for(Component c = this; c != host; c = c.getParent()) {
|
||||
for(Component c = this; c != host; c = c.getContainer()) {
|
||||
pt.x += c.x;
|
||||
pt.y += c.y;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue