Index: /trunk/src/org/openstreetmap/josm/gui/SideButton.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/SideButton.java	(revision 5470)
+++ /trunk/src/org/openstreetmap/josm/gui/SideButton.java	(revision 5471)
@@ -27,4 +27,6 @@
 public class SideButton extends JButton implements Destroyable {
     private final static int iconHeight = 20;
+    
+    private PropertyChangeListener propertyChangeListener;
 
     public SideButton(Action action)
@@ -52,12 +54,12 @@
     }
 
-    void fixIcon(Action action) {
+    private void fixIcon(Action action) {
         // need to listen for changes, so that putValue() that are called after the
         // SideButton is constructed get the proper icon size
-        if(action != null) {
-            action.addPropertyChangeListener(new PropertyChangeListener() {
+        if (action != null) {
+            action.addPropertyChangeListener(propertyChangeListener = new PropertyChangeListener() {
                 @Override
                 public void propertyChange(PropertyChangeEvent evt) {
-                    if(evt.getPropertyName() == javax.swing.Action.SMALL_ICON) {
+                    if (evt.getPropertyName() == javax.swing.Action.SMALL_ICON) {
                         fixIcon(null);
                     }
@@ -66,5 +68,5 @@
         }
         Icon i = getIcon();
-        if(i != null && i instanceof ImageIcon && i.getIconHeight() != iconHeight) {
+        if (i != null && i instanceof ImageIcon && i.getIconHeight() != iconHeight) {
             setIcon(getScaledImage(((ImageIcon) i).getImage()));
         }
@@ -144,5 +146,10 @@
             ((Destroyable) action).destroy();
         }
-        setAction(null);
+        if (action != null) {
+            if (propertyChangeListener != null) {
+                action.removePropertyChangeListener(propertyChangeListener);
+            }
+            setAction(null);
+        }
     }
 }
