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) { public void setPathEntryStore(IProject project, IPathEntryStore newStore) {
IPathEntryStore oldStore = null; IPathEntryStore oldStore = null;
synchronized (this) { synchronized (storeMap) {
oldStore = (IPathEntryStore)storeMap.remove(project); oldStore = (IPathEntryStore)storeMap.remove(project);
if (newStore != null) { if (newStore != null) {
storeMap.put(project, newStore); storeMap.put(project, newStore);
@ -1213,7 +1213,8 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
} }
} }
public synchronized IPathEntryStore getPathEntryStore(IProject project, boolean create) throws CoreException { public IPathEntryStore getPathEntryStore(IProject project, boolean create) throws CoreException {
synchronized (storeMap){
IPathEntryStore store = (IPathEntryStore)storeMap.get(project); IPathEntryStore store = (IPathEntryStore)storeMap.get(project);
if (store == null) { if (store == null) {
if(create == true){ if(create == true){
@ -1226,6 +1227,7 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
} }
return store; return store;
} }
}
public IPathEntryStore createPathEntryStore(IProject project) throws CoreException { public IPathEntryStore createPathEntryStore(IProject project) throws CoreException {
return new PathEntryStoreProxy(project); return new PathEntryStoreProxy(project);

View file

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