Skip to content

Commit

Permalink
Fixed : 修复removeEventListener方法导致的map列表未删除的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
TinyZzh committed May 14, 2016
1 parent de0ef05 commit 2e11ea2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion core/src/main/java/org/ogcs/event/EventListenerSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import java.util.Set;

/**
*
* The {@link EventListener} collection.
* @author TinyZ.
* @since 1.0
*/
Expand Down Expand Up @@ -50,6 +50,10 @@ public EventListener[] listeners() {
return listeners.toArray(new EventListener[listeners.size()]);
}

public boolean isEmpty() {
return listeners.isEmpty();
}

public int size() {
return listeners.size();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ public void removeEventListener(Object type, EventListener listener) {
return;
}
if (listeners instanceof EventListenerSet) {
((EventListenerSet) listeners).remove(listener);
EventListenerSet set = (EventListenerSet) listeners;
set.remove(listener);
if (set.isEmpty()) {
map.remove(type);
}
} else if (listeners.equals(listener)) {
map.remove(type);
}
Expand Down

0 comments on commit 2e11ea2

Please # to comment.