Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5078745

The mouse listener removed twice in BasicButtonUI#uninstallListeners

XMLWordPrintable

    • beta
    • generic, x86
    • generic, solaris_2.5.1



      Name: js151677 Date: 07/27/2004


      FULL PRODUCT VERSION :
      java version "1.4.2_05"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04)
      Java HotSpot(TM) Client VM (build 1.4.2_05-b04, mixed mode)

      A DESCRIPTION OF THE PROBLEM :
      The mouse listener removed twice in javax.swing.plaf.basic.BasicButtonUI#uninstallListeners.

      The line 174 is unnecessary. Here is the source code of #uninstallListeners:

          protected void uninstallListeners(AbstractButton b) {
              BasicButtonListener listener = (BasicButtonListener) b.getClientProperty(this);
              b.putClientProperty(this, null);
              if(listener != null) {
                  b.removeMouseListener(listener);
                  b.removeMouseListener(listener); //!!! <-- This line is unnecessary !!!!
                  b.removeMouseMotionListener(listener);
                  b.removeFocusListener(listener);
                  b.removeChangeListener(listener);
                  b.removePropertyChangeListener(listener);
              }
          }

      Please, don't forget to fix this in JDK 5.0 too!


      REPRODUCIBILITY :
      This bug can be reproduced always.
      (Incident Review ID: 289947)
      ======================================================================

            draskinsunw Daniel Raskin (Inactive)
            jssunw Jitender S (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: