mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 09:46:02 +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;
|
return;
|
||||||
}
|
}
|
||||||
|
final ICDescriptorListener[] listener;
|
||||||
synchronized (listeners) {
|
synchronized (listeners) {
|
||||||
final Iterator iterator = listeners.iterator();
|
listener = (ICDescriptorListener[])listeners.toArray(new ICDescriptorListener[listeners.size()]);
|
||||||
while (iterator.hasNext()) {
|
}
|
||||||
|
for (int i = 0; i < listener.length; i++) {
|
||||||
|
final int index = i;
|
||||||
Platform.run(new ISafeRunnable() {
|
Platform.run(new ISafeRunnable() {
|
||||||
|
|
||||||
public void handleException(Throwable exception) {
|
public void handleException(Throwable exception) {
|
||||||
|
@ -328,12 +331,11 @@ public class CDescriptorManager implements ICDescriptorManager, IResourceChangeL
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run() throws Exception {
|
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 {
|
public void runDescriptorOperation(IProject project, ICDescriptorOperation op, IProgressMonitor monitor) throws CoreException {
|
||||||
ICDescriptor descriptor = getDescriptor(project);
|
ICDescriptor descriptor = getDescriptor(project);
|
||||||
|
|
Loading…
Add table
Reference in a new issue