You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-commits@xmlgraphics.apache.org by ca...@apache.org on 2007/09/27 01:49:37 UTC

svn commit: r579851 - /xmlgraphics/batik/trunk/sources/org/apache/batik/dom/events/EventListenerList.java

Author: cam
Date: Wed Sep 26 16:49:35 2007
New Revision: 579851

URL: http://svn.apache.org/viewvc?rev=579851&view=rev
Log:
Fix bug where removing an event listener from an EventTarget that was not
the most recently added resulted in exceptions being thrown when the
event was subsequently dispatched.  Fixes bug 42228.

Modified:
    xmlgraphics/batik/trunk/sources/org/apache/batik/dom/events/EventListenerList.java

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/events/EventListenerList.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/events/EventListenerList.java?rev=579851&r1=579850&r2=579851&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/events/EventListenerList.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/events/EventListenerList.java Wed Sep 26 16:49:35 2007
@@ -91,8 +91,9 @@
                 && listener == head.listener) {
             head = head.next;
         } else {
+            Entry e;
             Entry prev = head;
-            for (Entry e = head.next; e != null; e = e.next) {
+            for (e = head.next; e != null; e = e.next) {
                 if ((namespaceURI != null && namespaceURI.equals(e.namespaceURI)
                             || namespaceURI == null && e.namespaceURI == null)
                         && e.listener == listener) {
@@ -101,8 +102,10 @@
                 }
                 prev = e;
             }
-            // Listener not present.
-            return;
+            if (e == null) {
+                // Listener not present.
+                return;
+            }
         }
         counts.dec(namespaceURI);
         n--;