Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2014-04-03 14:14:55 -0400
committerDoug Schaefer2014-04-03 14:14:55 -0400
commit1ab4528000bd3e1a5893c4e091aead95b7951f6c (patch)
tree40649eba24d75dd6aa4dbdb747b53ebe11a43aa8
parent126da7d685ccbbd971fe0135dead883dd2e3cab4 (diff)
downloadorg.eclipse.cdt-1ab4528000bd3e1a5893c4e091aead95b7951f6c.tar.gz
org.eclipse.cdt-1ab4528000bd3e1a5893c4e091aead95b7951f6c.tar.xz
org.eclipse.cdt-1ab4528000bd3e1a5893c4e091aead95b7951f6c.zip
Adjustments to adaptBinding stackOverflow solution.
Wrapped the method in try/finally and made inProgress thread local.
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java15
1 files changed, 8 insertions, 7 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java
index 2743a833941..c22cfcec58c 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java
@@ -1085,21 +1085,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 {

Back to the top