mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-30 12:25:35 +02:00
Bug 301229 - Don't create BinaryRunner inside synchronized block
This commit is contained in:
parent
2410fcc59a
commit
2233d1045a
1 changed files with 14 additions and 7 deletions
|
@ -473,8 +473,7 @@ public class CModelManager implements IResourceChangeListener, IContentTypeChang
|
||||||
try {
|
try {
|
||||||
fileStore = EFS.getStore(locationURI);
|
fileStore = EFS.getStore(locationURI);
|
||||||
} catch (CoreException e1) {
|
} catch (CoreException e1) {
|
||||||
// TODO Auto-generated catch block
|
CCorePlugin.log(e1);
|
||||||
e1.printStackTrace();
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -758,7 +757,7 @@ public class CModelManager implements IResourceChangeListener, IContentTypeChang
|
||||||
try {
|
try {
|
||||||
cproject.close();
|
cproject.close();
|
||||||
} catch (CModelException e) {
|
} catch (CModelException e) {
|
||||||
e.printStackTrace();
|
CCorePlugin.log(e);
|
||||||
}
|
}
|
||||||
binaryParsersMap.remove(project);
|
binaryParsersMap.remove(project);
|
||||||
|
|
||||||
|
@ -773,13 +772,21 @@ public class CModelManager implements IResourceChangeListener, IContentTypeChang
|
||||||
|
|
||||||
public BinaryRunner getBinaryRunner(ICProject cproject) {
|
public BinaryRunner getBinaryRunner(ICProject cproject) {
|
||||||
BinaryRunner runner = null;
|
BinaryRunner runner = null;
|
||||||
|
IProject project = cproject.getProject();
|
||||||
synchronized (binaryRunners) {
|
synchronized (binaryRunners) {
|
||||||
IProject project = cproject.getProject();
|
|
||||||
runner = binaryRunners.get(project);
|
runner = binaryRunners.get(project);
|
||||||
if (runner == null) {
|
}
|
||||||
runner = new BinaryRunner(project);
|
// creation of BinaryRunner must occur outside the synchronized block
|
||||||
|
if (runner == null) {
|
||||||
|
runner = new BinaryRunner(project);
|
||||||
|
}
|
||||||
|
synchronized (binaryRunners) {
|
||||||
|
if (binaryRunners.get(project) == null) {
|
||||||
binaryRunners.put(project, runner);
|
binaryRunners.put(project, runner);
|
||||||
runner.start();
|
runner.start();
|
||||||
|
} else {
|
||||||
|
// another thread was faster
|
||||||
|
runner = binaryRunners.get(project);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return runner;
|
return runner;
|
||||||
|
@ -891,7 +898,7 @@ public class CModelManager implements IResourceChangeListener, IContentTypeChang
|
||||||
fire(ElementChangedEvent.POST_CHANGE);
|
fire(ElementChangedEvent.POST_CHANGE);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
CCorePlugin.log(e);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue