Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix #162

Ruby.recursiveKey is never set, so it doesn't need to be a
ThreadLocal. Thanks to Ben Browning for the fix.
  • Loading branch information...
commit ca7ff04165bdaff2d2690baf0ca2cd129b663622 1 parent 268fdc4
@headius headius authored João Duarte committed
Showing with 6 additions and 13 deletions.
  1. +6 −13 src/org/jruby/Ruby.java
View
19 src/org/jruby/Ruby.java
@@ -1182,6 +1182,8 @@ private void initCore() {
encodingService = new EncodingService(this);
RubySymbol.createSymbolClass(this);
+
+ recursiveKey = newSymbol("__recursive_key__");
if (profile.allowClass("ThreadGroup")) {
RubyThreadGroup.createThreadGroupClass(this);
@@ -2776,11 +2778,6 @@ public void tearDown(boolean systemExit) {
// clear out threadlocals so they don't leak
recursive = new ThreadLocal<Map<String, RubyHash>>();
- recursiveKey = new ThreadLocal<RubySymbol>() {
- protected RubySymbol initialValue() {
- return newSymbol("__recursive_key__");
- }
- };
while (!atExitBlocks.empty()) {
RubyProc proc = atExitBlocks.pop();
@@ -3667,7 +3664,7 @@ private IRubyObject execRecursiveInternal(RecursiveFunction func, IRubyObject ob
ExecRecursiveParams p = new ExecRecursiveParams();
p.list = recursiveListAccess();
p.objid = obj.id();
- boolean outermost = outer && !recursiveCheck(p.list, recursiveKey.get(), null);
+ boolean outermost = outer && !recursiveCheck(p.list, recursiveKey, null);
if(recursiveCheck(p.list, p.objid, pairid)) {
if(outer && !outermost) {
throw new RecursiveError(p.list);
@@ -3680,7 +3677,7 @@ private IRubyObject execRecursiveInternal(RecursiveFunction func, IRubyObject ob
p.pairid = pairid;
if(outermost) {
- recursivePush(p.list, recursiveKey.get(), null);
+ recursivePush(p.list, recursiveKey, null);
try {
result = execRecursiveI(p);
} catch(RecursiveError e) {
@@ -3690,7 +3687,7 @@ private IRubyObject execRecursiveInternal(RecursiveFunction func, IRubyObject ob
result = p.list;
}
}
- recursivePop(p.list, recursiveKey.get(), null);
+ recursivePop(p.list, recursiveKey, null);
if(result == p.list) {
result = func.call(obj, true);
}
@@ -4288,10 +4285,6 @@ public CoverageData getCoverageData() {
// structures and such for recursive operations
private ThreadLocal<Map<String, RubyHash>> recursive = new ThreadLocal<Map<String, RubyHash>>();
- private ThreadLocal<RubySymbol> recursiveKey = new ThreadLocal<RubySymbol>() {
- protected RubySymbol initialValue() {
- return newSymbol("__recursive_key__");
- }
- };
+ private RubySymbol recursiveKey;
private ThreadLocal<Boolean> inRecursiveListOperation = new ThreadLocal<Boolean>();
}
Please sign in to comment.
Something went wrong with that request. Please try again.