Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 356707

Summary: [Activities] Activity add/removes listener during notification which results in inconsistent behaviour
Product: [Eclipse Project] Platform Reporter: bugs
Component: UIAssignee: Platform UI Triaged <platform-ui-triaged>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: remy.suen
Version: 3.6.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Whiteboard: stalebug

Description bugs CLA 2011-09-05 03:02:09 EDT
Build Identifier: 20110218-0911

org.eclipse.ui.internal.activities.Activity:

fireActivityChanged() operates directly on the listener list and not on a copy of it. Therefore if a listener is removed during the activityChange() subsequent listener are skipped.

I would suggest to make a temporary copy of the activityListener List and use it in the notification loop.

Reproducible: Always

Steps to Reproduce:
1. Add two IActivityListener to the same Activity (IActivity.addActivityListener)
2. Let the first listener remove itself from the activity when called by calling IActivity.removeActivityListener
3. Change the activity on which the two listener where added. Result: The first listener removes itself from IActivity and the second listener is not called.
Comment 1 Lars Vogel CLA 2019-11-14 03:24:03 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

If the bug is still relevant, please remove the "stalebug" whiteboard tag.