7124363: [macosx] ClassCastException: CFileDialog cannot be cast to LWWindowPeer
authorpchelko
Wed, 02 Oct 2013 11:18:17 +0400
changeset 20445 9440dd9e78d1
parent 20444 93251debbb6f
child 20446 2452a42716c8
7124363: [macosx] ClassCastException: CFileDialog cannot be cast to LWWindowPeer Reviewed-by: anthony, serb
jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java
--- a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Tue Oct 01 18:40:35 2013 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Wed Oct 02 11:18:17 2013 +0400
@@ -393,8 +393,12 @@
     @Override
     public void setModalBlocked(Dialog blocker, boolean blocked) {
         synchronized (getPeerTreeLock()) {
-            this.blocker = !blocked ? null :
-            (LWWindowPeer) AWTAccessor.getComponentAccessor().getPeer(blocker);
+            ComponentPeer peer =  AWTAccessor.getComponentAccessor().getPeer(blocker);
+            if (blocked && (peer instanceof LWWindowPeer)) {
+                this.blocker = (LWWindowPeer) peer;
+            } else {
+                this.blocker = null;
+            }
         }
 
         platformWindow.setModalBlocked(blocked);