scala-swing icon indicating copy to clipboard operation
scala-swing copied to clipboard

Component/Publisher initialization may be broken -- or is somewhat obscure

Open scabug opened this issue 14 years ago • 2 comments

I'm not quite sure whether this is a bug or intended behavior: A Publisher automatically listens to itself, "for convenience". For a Component, this call to listenTo() calls Publisher's subscribe, not LazyPublisher's - because it happens within initialization, if I'm correct. Additionally, LazyPublisher.subscribe checks for listeners.size == 1 rather than 0. Is this the way it was meant to be? If so, it is at least very obscure, and it would be nice of you to add some comment, because it's hard to tell from the code what's going on and how it should be used.

My current solution is to call listenTo(this) again in my Component subclass. This works for me, but is this how you intended it to be used? Is the calling of listenTo(this) in Publisher really a good thing? Maybe it makes things more complicated than it's worth... What do you think?

Christoph

scabug avatar Aug 12 '11 18:08 scabug

Imported From: https://issues.scala-lang.org/browse/SI-4904?orig=1 Reporter: Christoph Radig (cradig) Affected Versions: 2.9.1

scabug avatar Aug 12 '11 18:08 scabug

@adriaanm said: Unassigning as milestone deadline was reached.

scabug avatar Jul 10 '13 22:07 scabug