Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Recoskie2009-11-13 15:26:36 -0500
committerChris Recoskie2009-11-13 15:26:36 -0500
commitad638017930e4b45b83d4933d859d3080caf30cb (patch)
tree4a69daad3e9d3a29724cef7989b457568a60ecef
parent890e98fd68e8b3c78ad91684667b1f0933c0c99f (diff)
downloadorg.eclipse.cdt-ad638017930e4b45b83d4933d859d3080caf30cb.tar.gz
org.eclipse.cdt-ad638017930e4b45b83d4933d859d3080caf30cb.tar.xz
org.eclipse.cdt-ad638017930e4b45b83d4933d859d3080caf30cb.zip
Bug 295117 - deadlock in CfgDiscoveredPathManager.getDiscoveredInfo()
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/CfgDiscoveredPathManager.java53
1 files changed, 40 insertions, 13 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/CfgDiscoveredPathManager.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/CfgDiscoveredPathManager.java
index 15295bbf6f..744659519f 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/CfgDiscoveredPathManager.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/CfgDiscoveredPathManager.java
@@ -67,6 +67,39 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener {
private IDiscoveredPathManager fBaseMngr;
+
+ private class GetDiscoveredInfoRunnable implements IWorkspaceRunnable {
+
+ private PathInfo fPathInfo;
+ private ContextInfo fContextInfo;
+ private IProject fProject;
+ private CfgInfoContext fContext;
+
+ public GetDiscoveredInfoRunnable(ContextInfo cInfo, IProject project, CfgInfoContext context) {
+ fContextInfo = cInfo;
+ fProject = project;
+ fContext = context;
+ }
+
+ public void run(IProgressMonitor monitor) throws CoreException {
+
+ fPathInfo = getCachedPathInfo(fContextInfo);
+
+ if(fPathInfo == null){
+ IDiscoveredPathManager.IDiscoveredPathInfo baseInfo = loadPathInfo(fProject, fContext.getConfiguration(), fContextInfo);
+
+ fPathInfo = resolveCacheBaseDiscoveredInfo(fContextInfo, baseInfo);
+ }
+
+ }
+
+ public PathInfo getPathInfo() {
+ return fPathInfo;
+ }
+
+ };
+
+
private static class ContextInfo {
public ContextInfo() {
@@ -161,21 +194,15 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener {
PathInfo info = getCachedPathInfo(cInfo);
if (info == null) {
- synchronized (this) {
- info = getCachedPathInfo(cInfo);
+ // Change synchronization to be a workspace lock on the project. Otherwise
+ // if the project description is queried from a project change listener, it will deadlock
+
+ GetDiscoveredInfoRunnable runnable = new GetDiscoveredInfoRunnable(cInfo, project, context);
- if(info == null){
- IDiscoveredPathManager.IDiscoveredPathInfo baseInfo = loadPathInfo(project, context.getConfiguration(), cInfo);
-
- info = resolveCacheBaseDiscoveredInfo(cInfo, baseInfo);
- }
- }
+ ResourcesPlugin.getWorkspace().run(runnable, project, IWorkspace.AVOID_UPDATE, null);
+
+ info = runnable.getPathInfo();
-// setCachedPathInfo(context, info);
-// if(info instanceof DiscoveredPathInfo && !((DiscoveredPathInfo)info).isLoadded()){
-// info = createPathInfo(project, context);
-// setCachedPathInfo(context, info);
-// }
}
return info;
}

Back to the top