Ticket #588 (closed defect: fixed)
addListener() should not add same listener multiple times
| Reported by: | Marc Englund | Owned by: | Jani Laakso |
|---|---|---|---|
| Priority: | undefined | Milestone: | User Interface Library 5.2.0 RC |
| Component: | Server-side framework | Version: | 4.0.1-rc |
| Keywords: | Cc: | ||
| Known Issue description: | |||
| Hours estimate: | Deadline (dd.mm.yyyy): | ||
| Known Issue version (since): | Known Issue title: | ||
| Hours done: | Depends to: | ||
| Affects documentation: | no | ||
| Known Issue workaround: | |||
| Affects release notes: | no | Contract: | |
Description
addListener() should not add the same listener multiple times, even if it's called several times with the same object.
Problem:
button.addListener(this);
button.addListener(this);
-> this.buttonClick() is called twice for each click.
-> does button.removeListener(this) remove first, last or both listeners?
Cause:
EventRouter? uses LinkedList? instead of HashSet? to store listeners. Do we have a situation when adding the same listener twice makes sense? (probably not)
Change History
Note: See
TracTickets for help on using
tickets.
