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:
parent
bb13674e2f
commit
875523b31e
1 changed files with 32 additions and 30 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue