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:
parent
c1eb0f1f5f
commit
5a6ebce09c
1 changed files with 8 additions and 7 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue