Skip to content
Browse files

SI-8019 Make Publisher check PartialFunction is defined for Event

Reactions are PartialFunctions, so if events come through
indiscriminately that the listener is not defined for, errors occur. Eg:

Exception in thread "AWT-EventQueue-0" scala.MatchError: FocusGained(scala.swing wrapper scala.swing.TextField

A Coursera thread with people affected by this issue:
  • Loading branch information...
rtyley committed Nov 29, 2013
1 parent db19ddf commit c955cf4c2ee88d1f94cd45aeee238fc5344d2f18
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/swing/scala/swing/Publisher.scala
@@ -44,7 +44,7 @@ trait Publisher extends Reactor {
* Notify all registered reactions.
def publish(e: Event) { for (l <- listeners) l(e) }
def publish(e: Event) { for (l <- listeners) if (l.isDefinedAt(e)) l(e) }


0 comments on commit c955cf4

Please sign in to comment.
You can’t perform that action at this time.