1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 01:36:01 +02:00

fixed concurrent mod of listener list when fireing events

This commit is contained in:
David Inglis 2004-05-13 14:59:18 +00:00
parent bb13674e2f
commit 875523b31e

View file

@ -316,9 +316,12 @@ public class CDescriptorManager implements ICDescriptorManager, IResourceChangeL
}
return;
}
final ICDescriptorListener[] listener;
synchronized (listeners) {
final Iterator iterator = listeners.iterator();
while (iterator.hasNext()) {
listener = (ICDescriptorListener[])listeners.toArray(new ICDescriptorListener[listeners.size()]);
}
for (int i = 0; i < listener.length; i++) {
final int index = i;
Platform.run(new ISafeRunnable() {
public void handleException(Throwable exception) {
@ -328,12 +331,11 @@ public class CDescriptorManager implements ICDescriptorManager, IResourceChangeL
}
public void run() throws Exception {
((ICDescriptorListener) iterator.next()).descriptorChanged(event);
listener[index].descriptorChanged(event);
}
});
}
}
}
public void runDescriptorOperation(IProject project, ICDescriptorOperation op, IProgressMonitor monitor) throws CoreException {
ICDescriptor descriptor = getDescriptor(project);