jdk/src/macosx/classes/sun/lwawt/macosx/CTrayIcon.java
changeset 23247 dd6c58eeb05c
parent 18241 3e009b5be123
child 23268 2cdb715ff32d
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CTrayIcon.java	Thu Dec 19 16:49:27 2013 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CTrayIcon.java	Fri Dec 20 14:42:37 2013 +0400
@@ -76,8 +76,9 @@
                 menuPeer = (CPopupMenu)popup.getPeer();
                 if (menuPeer == null) {
                     popup.addNotify();
+                    menuPeer = (CPopupMenu)popup.getPeer();
                 }
-            }catch (Exception e){
+            } catch (Exception e) {
                 e.printStackTrace();
             }
         }
@@ -97,7 +98,12 @@
     //invocation from the AWTTrayIcon.m
     public long getPopupMenuModel(){
         if(popup == null) {
-            return 0L;
+            PopupMenu popupMenu = target.getPopupMenu();
+            if (popupMenu != null) {
+                popup = popupMenu;
+            } else {
+                return 0L;
+            }
         }
         return checkAndCreatePopupPeer().getModel();
     }
@@ -134,6 +140,10 @@
 
         dummyFrame.dispose();
 
+        if (popup != null) {
+            popup.removeNotify();
+        }
+
         LWCToolkit.targetDisposedPeer(target, this);
         target = null;