Community
Participate
Working Groups
We have several view parts that subscribe to events using the IEventBroker. I wondered why a part's subscriptions on its IEventBroker weren't being removed on part close. It turns out that the EventBrokerFactory context function does a get() rather than getLocal(). So if an event broker has been allocated in a parent, that broker will be used for all children. Since a broker is created on the workbench context on startup as a result of configuring the EModelService, and so this instance effectively becomes a singleton instance for the application. I think is a bug. Or at least having a part's subscriptions be automatically expired on close seems to be a big benefit that we're not getting.
When we started we were using the mediator pattern here (which provides cleanup on context dispose). We might have changed our tact but not considered the cleanup pattern. PW
Shocked and appalled that this is broken.
Fixed in http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=d7f3319ec189cad722b4bbace2d8a7ebe79d4ebf
Verified in I20120430-1800