Project: Eclipse_Platform_UI
Bug 359887 Removing IIdentifierListener corrupts changed event list
Reported: 2011-10-04 14:03:45 | Status: verified fixed

Calling IIdentifier.removeIdentifierListener(IIdentifierListener) in an identifierChanged() handler will corrupt the event list resulting in only every 2nd listener receiving notification of the event. This is because the Identifier.fireIdentifierChanged method is iterating over the identifiers list with an index based for loop, while the removeIdentifierListener is concurrently modifying the same list. This defect exists in 3.8 as well. It is not obvious to us because we only ever register one listener with the identifier, the LayoutHelper. I discovered this while implementing some capabilities work in 4.2. I was registering a listener for each view and not all views where being notified when the Identifier changed.

Files changed in fix:
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/Identifier.java