The DefaultEventBus is making poor choices in where to publish events.
- The immediate
publish method publishes to the EDT. Thus if the result of this publish tries to do something on the EDT it will deadlock.
- The
publishLater method uses ThreadService.run, which runs on an arbitrary thread. Thus subsequent publishLater calls are not guaranteed to execute in a consistent order.
To resolve this issue, we should have a dedicated SciJava event-processing thread which runs all EventBus publications.