1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 06:05:24 +02:00

Adjustments to adaptBinding stackOverflow solution.

Wrapped the method in try/finally and made inProgress thread local.
This commit is contained in:
Doug Schaefer 2014-04-03 14:14:55 -04:00
parent c1eb0f1f5f
commit 5a6ebce09c

View file

@ -1088,21 +1088,22 @@ public class PDOM extends PlatformObject implements IPDOM {
return fLinkageIDCache.get(linkage.getLinkageID());
}
private IBinding inProgress;
private ThreadLocal<IBinding> inProgress = new ThreadLocal<IBinding>();
@Override
public IIndexFragmentBinding adaptBinding(IBinding binding) throws CoreException {
if (inProgress == binding) {
if (inProgress.get() == binding) {
// Detect if we're recursing during the adapt. That shouldn't happen and
// leads to stack overflow when it does.
return null;
}
inProgress = binding;
IIndexFragmentBinding result = adaptBinding(binding, true);
inProgress = null;
return result;
inProgress.set(binding);
try {
return adaptBinding(binding, true);
} finally {
inProgress.set(null);
}
}
private IIndexFragmentBinding adaptBinding(IBinding binding, boolean includeLocal) throws CoreException {