diff --git a/src/solaris/classes/sun/awt/X11/XMouseInfoPeer.java b/src/solaris/classes/sun/awt/X11/XMouseInfoPeer.java index ea45452d285e17f1397de70d261ced25d9deb212..eb36d5aeb950655cda68fdcb93bb61488a586f7f 100644 --- a/src/solaris/classes/sun/awt/X11/XMouseInfoPeer.java +++ b/src/solaris/classes/sun/awt/X11/XMouseInfoPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, 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 @@ -25,11 +25,10 @@ package sun.awt.X11; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; import java.awt.Point; import java.awt.Window; -import java.awt.GraphicsEnvironment; -import java.awt.GraphicsConfiguration; -import java.awt.GraphicsDevice; import java.awt.peer.MouseInfoPeer; public class XMouseInfoPeer implements MouseInfoPeer { @@ -76,14 +75,15 @@ public class XMouseInfoPeer implements MouseInfoPeer { } public boolean isWindowUnderMouse(Window w) { - + if (w == null) { + return false; + } + XWindow peer = (XWindow) w.getPeer(); + if (peer == null) { + return false; + } long display = XToolkit.getDisplay(); - - // java.awt.Component.findUnderMouseInWindow checks that - // the peer is non-null by checking that the component - // is showing. - - long contentWindow = ((XWindow)w.getPeer()).getContentWindow(); + long contentWindow = peer.getContentWindow(); long parent = XlibUtil.getParentWindow(contentWindow); XToolkit.awtLock(); diff --git a/src/windows/native/sun/windows/MouseInfo.cpp b/src/windows/native/sun/windows/MouseInfo.cpp index b109f28ded809ea1c0228bf66097a15e33b96042..5ff1a8ec03c4b0fd48f617d8f0b414b59c9269d8 100644 --- a/src/windows/native/sun/windows/MouseInfo.cpp +++ b/src/windows/native/sun/windows/MouseInfo.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, 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 @@ -48,6 +48,7 @@ Java_sun_awt_DefaultMouseInfoPeer_isWindowUnderMouse(JNIEnv *env, jclass cls, } jobject winPeer = AwtObject::GetPeerForTarget(env, window); + CHECK_NULL_RETURN(winPeer, JNI_FALSE); PDATA pData; pData = JNI_GET_PDATA(winPeer); env->DeleteLocalRef(winPeer);