mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-26 18:35:32 +02:00
Adjustments to adaptBinding stackOverflow solution.
Wrapped the method in try/finally and made inProgress thread local.
This commit is contained in:
parent
126da7d685
commit
1ab4528000
1 changed files with 8 additions and 7 deletions
|
@ -1085,21 +1085,22 @@ public class PDOM extends PlatformObject implements IPDOM {
|
||||||
return fLinkageIDCache.get(linkage.getLinkageID());
|
return fLinkageIDCache.get(linkage.getLinkageID());
|
||||||
}
|
}
|
||||||
|
|
||||||
private IBinding inProgress;
|
private ThreadLocal<IBinding> inProgress = new ThreadLocal<IBinding>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIndexFragmentBinding adaptBinding(IBinding binding) throws CoreException {
|
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
|
// Detect if we're recursing during the adapt. That shouldn't happen and
|
||||||
// leads to stack overflow when it does.
|
// leads to stack overflow when it does.
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
inProgress = binding;
|
inProgress.set(binding);
|
||||||
IIndexFragmentBinding result = adaptBinding(binding, true);
|
try {
|
||||||
inProgress = null;
|
return adaptBinding(binding, true);
|
||||||
|
} finally {
|
||||||
return result;
|
inProgress.set(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private IIndexFragmentBinding adaptBinding(IBinding binding, boolean includeLocal) throws CoreException {
|
private IIndexFragmentBinding adaptBinding(IBinding binding, boolean includeLocal) throws CoreException {
|
||||||
|
|
Loading…
Add table
Reference in a new issue