diff options
Diffstat (limited to 'build/org.eclipse.cdt.managedbuilder.core')
3 files changed, 48 insertions, 16 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/core/scannerconfig/ScannerConfigBuilder.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/core/scannerconfig/ScannerConfigBuilder.java index 0750897a3bf..356bc1ab269 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/core/scannerconfig/ScannerConfigBuilder.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/core/scannerconfig/ScannerConfigBuilder.java @@ -199,7 +199,9 @@ public class ScannerConfigBuilder extends ACBuilder { // update and persist scanner configuration CfgSCJobsUtil.updateScannerConfiguration(project, context, instance, buildInfo2, new SubProgressMonitor(monitor, 30)); - CfgDiscoveredPathManager.getInstance().removeDiscoveredInfo(project, context, false); + // this erroneously removes the infor right after it gets created... bad + //CfgDiscoveredPathManager.getInstance().removeDiscoveredInfo(project, context, false); + if((flags & PERFORM_CORE_UPDATE) != 0) CfgDiscoveredPathManager.getInstance().updateCoreSettings(project, new IConfiguration[]{cfg}); 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 15295bbf6f1..cd32ab4447f 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 Intel Corporation and others. + * Copyright (c) 2007, 2010 Intel Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,6 +7,7 @@ * * Contributors: * Intel Corporation - Initial API and implementation + * IBM Corporation *******************************************************************************/ package org.eclipse.cdt.build.internal.core.scannerconfig; @@ -59,6 +60,7 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.jobs.ISchedulingRule; public class CfgDiscoveredPathManager implements IResourceChangeListener { @@ -67,6 +69,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 +196,16 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener { PathInfo info = getCachedPathInfo(cInfo); if (info == null) { - synchronized (this) { - info = getCachedPathInfo(cInfo); + // Change synchronization to be a 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); + ISchedulingRule rule = project; - if(info == null){ - IDiscoveredPathManager.IDiscoveredPathInfo baseInfo = loadPathInfo(project, context.getConfiguration(), cInfo); - - info = resolveCacheBaseDiscoveredInfo(cInfo, baseInfo); - } - } + ResourcesPlugin.getWorkspace().run(runnable, rule, 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; } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties index f08762cb4d3..cb4ff40b0b2 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2002, 2007 Rational Software Corporation and others. +# Copyright (c) 2002, 2010 Rational Software Corporation and others. # All rights reserved. This program and the accompanying materials # are made available under the terms of the Eclipse Public License v1.0 # which accompanies this distribution, and is available at |