Index: trunk/src/org/openstreetmap/josm/actions/relation/RecentRelationsAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/relation/RecentRelationsAction.java	(revision 14247)
+++ trunk/src/org/openstreetmap/josm/actions/relation/RecentRelationsAction.java	(revision 14248)
@@ -159,6 +159,8 @@
 
         static void launch(Component parent, KeyStroke keystroke) {
-            Rectangle r = parent.getBounds();
-            new RecentRelationsPopupMenu(getRecentRelationsOnActiveLayer(), keystroke).show(parent, r.x, r.y + r.height);
+            if (parent.isShowing()) {
+                Rectangle r = parent.getBounds();
+                new RecentRelationsPopupMenu(getRecentRelationsOnActiveLayer(), keystroke).show(parent, r.x, r.y + r.height);
+            }
         }
     }
Index: trunk/src/org/openstreetmap/josm/gui/ImageryMenu.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/ImageryMenu.java	(revision 14247)
+++ trunk/src/org/openstreetmap/josm/gui/ImageryMenu.java	(revision 14248)
@@ -72,5 +72,5 @@
                     ((JMenuItem) c).getAction().actionPerformed(e);
                 } else {
-                    if (source == null) return;
+                    if (source == null || !source.isShowing()) return;
                     popup.show(source, source.getWidth()/2, source.getHeight()/2);
                 }
Index: trunk/src/org/openstreetmap/josm/gui/MapFrame.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/MapFrame.java	(revision 14247)
+++ trunk/src/org/openstreetmap/josm/gui/MapFrame.java	(revision 14248)
@@ -682,5 +682,5 @@
                 }));
             }
-            if (button != null) {
+            if (button != null && button.isShowing()) {
                 Rectangle bounds = button.getBounds();
                 menu.show(button, bounds.x + bounds.width, 0);
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/layer/LayerVisibilityAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/layer/LayerVisibilityAction.java	(revision 14247)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/layer/LayerVisibilityAction.java	(revision 14248)
@@ -35,4 +35,5 @@
 
 import org.openstreetmap.josm.gui.MainApplication;
+import org.openstreetmap.josm.gui.MainFrame;
 import org.openstreetmap.josm.gui.SideButton;
 import org.openstreetmap.josm.gui.dialogs.IEnabledStateUpdating;
@@ -113,11 +114,14 @@
         updateValues();
         if (e.getSource() == sideButton) {
-            popup.show(sideButton, 0, sideButton.getHeight());
+            if (sideButton.isShowing()) {
+                popup.show(sideButton, 0, sideButton.getHeight());
+            }
         } else {
             // Action can be trigger either by opacity button or by popup menu (in case toggle buttons are hidden).
             // In that case, show it in the middle of screen (because opacityButton is not visible)
-            popup.show(MainApplication.getMainFrame(),
-                    MainApplication.getMainFrame().getWidth() / 2,
-                    (MainApplication.getMainFrame().getHeight() - popup.getHeight()) / 2);
+            MainFrame mainFrame = MainApplication.getMainFrame();
+            if (mainFrame.isShowing()) {
+                popup.show(mainFrame, mainFrame.getWidth() / 2, (mainFrame.getHeight() - popup.getHeight()) / 2);
+            }
         }
     }
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java	(revision 14247)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java	(revision 14248)
@@ -967,5 +967,8 @@
                             action.actionPerformed(null);
                             if (SwingUtilities.isRightMouseButton(e)) {
-                                new TagPopupMenu(t).show(e.getComponent(), e.getX(), e.getY());
+                                Component component = e.getComponent();
+                                if (component.isShowing()) {
+                                    new TagPopupMenu(t).show(component, e.getX(), e.getY());
+                                }
                             } else if (e.isShiftDown()) {
                                 // add tags on Shift-Click
Index: trunk/src/org/openstreetmap/josm/gui/download/UserQueryList.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/download/UserQueryList.java	(revision 14247)
+++ trunk/src/org/openstreetmap/josm/gui/download/UserQueryList.java	(revision 14248)
@@ -323,9 +323,13 @@
                 if (model.getSize() == 0 || index == -1) {
                     list.clearSelection();
-                    emptySelectionPopup.show(list, e.getX(), e.getY());
+                    if (list.isShowing()) {
+                        emptySelectionPopup.show(list, e.getX(), e.getY());
+                    }
                 } else {
                     list.setSelectedIndex(index);
                     list.ensureIndexIsVisible(index);
-                    elementPopup.show(list, e.getX(), e.getY());
+                    if (list.isShowing()) {
+                        elementPopup.show(list, e.getX(), e.getY());
+                    }
                 }
             }
Index: trunk/src/org/openstreetmap/josm/gui/history/OpenChangesetPopupMenu.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/history/OpenChangesetPopupMenu.java	(revision 14247)
+++ trunk/src/org/openstreetmap/josm/gui/history/OpenChangesetPopupMenu.java	(revision 14248)
@@ -4,4 +4,5 @@
 import static org.openstreetmap.josm.tools.I18n.tr;
 
+import java.awt.Container;
 import java.awt.Rectangle;
 import java.awt.event.ActionEvent;
@@ -46,6 +47,9 @@
      */
     public void show(final JComponent parent) {
-        final Rectangle r = parent.getBounds();
-        show(parent.getParent(), r.x, r.y + r.height);
+        Container parentParent = parent.getParent();
+        if (parentParent.isShowing()) {
+            final Rectangle r = parent.getBounds();
+            show(parentParent, r.x, r.y + r.height);
+        }
     }
 
Index: trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java	(revision 14247)
+++ trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java	(revision 14248)
@@ -5,4 +5,5 @@
 
 import java.awt.Color;
+import java.awt.Component;
 import java.awt.Dimension;
 import java.awt.Font;
@@ -191,5 +192,8 @@
             if (!isVisible()) return;
             if (e.getButton() == MouseEvent.BUTTON3) {
-                new TileSourceLayerPopup(e.getX(), e.getY()).show(e.getComponent(), e.getX(), e.getY());
+                Component component = e.getComponent();
+                if (component.isShowing()) {
+                    new TileSourceLayerPopup(e.getX(), e.getY()).show(component, e.getX(), e.getY());
+                }
             } else if (e.getButton() == MouseEvent.BUTTON1) {
                 attribution.handleAttribution(e.getPoint(), true);
Index: trunk/src/org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreference.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreference.java	(revision 14247)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreference.java	(revision 14248)
@@ -173,6 +173,9 @@
         more.addActionListener(new ActionListener() {
             private JPopupMenu menu = buildPopupMenu();
-            @Override public void actionPerformed(ActionEvent ev) {
-                menu.show(more, 0, 0);
+            @Override
+            public void actionPerformed(ActionEvent ev) {
+                if (more.isShowing()) {
+                    menu.show(more, 0, 0);
+                }
             }
         });
Index: trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetMenu.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetMenu.java	(revision 14247)
+++ trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetMenu.java	(revision 14248)
@@ -106,5 +106,7 @@
                     Point p = pointerInfo.getLocation();
                     MainFrame parent = MainApplication.getMainFrame();
-                    pm.show(parent, p.x-parent.getX(), p.y-parent.getY());
+                    if (parent.isShowing()) {
+                        pm.show(parent, p.x-parent.getX(), p.y-parent.getY());
+                    }
                 }
             } catch (SecurityException ex) {
Index: trunk/src/org/openstreetmap/josm/gui/util/MultikeyActionsHandler.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/util/MultikeyActionsHandler.java	(revision 14247)
+++ trunk/src/org/openstreetmap/josm/gui/util/MultikeyActionsHandler.java	(revision 14248)
@@ -24,4 +24,5 @@
 
 import org.openstreetmap.josm.gui.MainApplication;
+import org.openstreetmap.josm.gui.MainFrame;
 import org.openstreetmap.josm.gui.util.MultikeyShortcutAction.MultikeyInfo;
 import org.openstreetmap.josm.tools.Shortcut;
@@ -101,7 +102,10 @@
             }
             layers.addPopupMenuListener(new StatusLinePopupMenuListener());
-            layers.show(MainApplication.getMainFrame(), Integer.MAX_VALUE, Integer.MAX_VALUE);
-            layers.setLocation(MainApplication.getMainFrame().getX() + MainApplication.getMainFrame().getWidth() - layers.getWidth(),
-                               MainApplication.getMainFrame().getY() + MainApplication.getMainFrame().getHeight() - layers.getHeight());
+            MainFrame mainFrame = MainApplication.getMainFrame();
+            if (mainFrame.isShowing()) {
+                layers.show(mainFrame, Integer.MAX_VALUE, Integer.MAX_VALUE);
+                layers.setLocation(mainFrame.getX() + mainFrame.getWidth() - layers.getWidth(),
+                                   mainFrame.getY() + mainFrame.getHeight() - layers.getHeight());
+            }
         }
     }
Index: trunk/src/org/openstreetmap/josm/gui/widgets/PopupMenuButton.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/widgets/PopupMenuButton.java	(revision 14247)
+++ trunk/src/org/openstreetmap/josm/gui/widgets/PopupMenuButton.java	(revision 14248)
@@ -144,10 +144,12 @@
      */
     public void setPopupMenu(JPopupMenu m) {
-        this.menu = m;
+        menu = m;
     }
 
     @Override
     public void actionPerformed(ActionEvent e) {
-        this.menu.show(this, 0, this.getHeight());
+        if (isShowing()) {
+            menu.show(this, 0, this.getHeight());
+        }
     }
 
Index: trunk/src/org/openstreetmap/josm/gui/widgets/PopupMenuLauncher.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/widgets/PopupMenuLauncher.java	(revision 14247)
+++ trunk/src/org/openstreetmap/josm/gui/widgets/PopupMenuLauncher.java	(revision 14248)
@@ -109,5 +109,8 @@
     protected void showMenu(MouseEvent evt) {
         if (menu != null && evt != null) {
-            menu.show(evt.getComponent(), evt.getX(), evt.getY());
+            Component component = evt.getComponent();
+            if (component.isShowing()) {
+                menu.show(component, evt.getX(), evt.getY());
+            }
         }
     }
