Ticket #588 (closed defect: fixed)

Opened 19 months ago

Last modified 7 months ago

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

Changed 14 months ago by Jani Laakso

  • milestone deleted

Milestone 4.0 Candidates for next release deleted

Changed 10 months ago by Joonas Lehtinen

  • milestone set to User Interface Library 5.1.0 RC
  • affects_release_notes unset

Changed 10 months ago by Marc Englund

NOTE: Listeners should be kept in order; LinkedHashSet? should probably be used.

Changed 10 months ago by Marc Englund

NOTE 2:

  1. addListener(foo)
  2. addListener(bar)
  3. addListener(foo)

Should foo or bar be called first? (document!)

Changed 10 months ago by Joonas Lehtinen

IMO foo should be called first

Changed 10 months ago by Jani Laakso

Partially fixed in [3681]

Changed 9 months ago by Joonas Lehtinen

  • priority changed from minor to undefined

Changed 9 months ago by Jani Laakso

  • status changed from new to closed
  • resolution set to fixed

I've already fixed this..

Changed 7 months ago by Joonas Lehtinen

  • milestone changed from User Interface Library 5.1.2 to User Interface Library 5.2.0

Milestone User Interface Library 5.1.2 deleted

Note: See TracTickets for help on using tickets.