1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug #204881 : Deadlock between PathEntryManager and CProjectDescriptionManager

This commit is contained in:
Oleg Krasilnikov 2007-10-02 13:36:11 +00:00
parent 0ccfe513e0
commit d0c30f1b23
2 changed files with 16 additions and 14 deletions

View file

@ -1200,7 +1200,7 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
public void setPathEntryStore(IProject project, IPathEntryStore newStore) {
IPathEntryStore oldStore = null;
synchronized (this) {
synchronized (storeMap) {
oldStore = (IPathEntryStore)storeMap.remove(project);
if (newStore != null) {
storeMap.put(project, newStore);
@ -1213,18 +1213,20 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
}
}
public synchronized IPathEntryStore getPathEntryStore(IProject project, boolean create) throws CoreException {
IPathEntryStore store = (IPathEntryStore)storeMap.get(project);
if (store == null) {
if(create == true){
store = createPathEntryStore(project);
storeMap.put(project, store);
store.addPathEntryStoreListener(this);
public IPathEntryStore getPathEntryStore(IProject project, boolean create) throws CoreException {
synchronized (storeMap){
IPathEntryStore store = (IPathEntryStore)storeMap.get(project);
if (store == null) {
if(create == true){
store = createPathEntryStore(project);
storeMap.put(project, store);
store.addPathEntryStoreListener(this);
}
} else if (store instanceof AbstractCExtensionProxy){
((AbstractCExtensionProxy)store).updateProject(project);
}
} else if (store instanceof AbstractCExtensionProxy){
((AbstractCExtensionProxy)store).updateProject(project);
return store;
}
return store;
}
public IPathEntryStore createPathEntryStore(IProject project) throws CoreException {

View file

@ -2807,13 +2807,13 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
}
public void addCProjectDescriptionListener(ICProjectDescriptionListener listener, int eventTypes){
synchronized(this){
synchronized(fListeners){
fListeners.add(new ListenerDescriptor(listener, eventTypes));
}
}
public void removeCProjectDescriptionListener(ICProjectDescriptionListener listener){
synchronized(this){
synchronized(fListeners){
int size = fListeners.size();
ListenerDescriptor des;
for(int i = 0; i < size; i++){
@ -2827,7 +2827,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
}
private ListenerDescriptor[] getListeners(){
synchronized(this){
synchronized(fListeners){
return (ListenerDescriptor[])fListeners.toArray(new ListenerDescriptor[fListeners.size()]);
}
}