Project: Eclipse_Platform_UI
Bug 374534 IEventBroker instances are not actually allocated and destroyed on a per-context basis
Reported: 2012-03-16 13:05:10 | Status: verified fixed

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.

Files changed in fix:
bundles/org.eclipse.e4.ui.services/src/org/eclipse/e4/ui/services/events/EventBrokerFactory.java tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/UIEventsTest.java