Permalink
Browse files

Only capture a shallow copy of the current Frame in binding-conveyor-…

…fn, so that sends in agent actions don't built infinite Frame stacks. Fixes CLJ-898.

Signed-off-by: Stuart Sierra <mail@stuartsierra.com>
  • Loading branch information...
tsdh authored and stuartsierra committed Dec 16, 2011
1 parent 0cd1dc8 commit 12f07da889819bc5613546ec223e97ac27c86dbf
Showing with 15 additions and 1 deletion.
  1. +1 −1 src/clj/clojure/core.clj
  2. +14 −0 src/jvm/clojure/lang/Var.java
View
@@ -1812,7 +1812,7 @@
{:private true
:added "1.3"}
[f]
- (let [frame (clojure.lang.Var/getThreadBindingFrame)]
+ (let [frame (clojure.lang.Var/cloneThreadBindingFrame)]
(fn
([]
(clojure.lang.Var/resetThreadBindingFrame frame)
@@ -61,6 +61,13 @@ public Frame(Associative bindings, Frame prev){
this.bindings = bindings;
this.prev = prev;
}
+
+ protected Object clone() {
+ Frame f = new Frame();
+ f.bindings = this.bindings;
+ return f;
+ }
+
}
static final ThreadLocal<Frame> dvals = new ThreadLocal<Frame>(){
@@ -95,6 +102,13 @@ public static Object getThreadBindingFrame(){
return new Frame();
}
+public static Object cloneThreadBindingFrame(){
+ Frame f = (Frame) dvals.get().clone();

This comment has been minimized.

Show comment Hide comment
@dmiller

dmiller Jan 14, 2012

Member

.clone() can't be null. looking at getThreadingBindingFrame, should probably be

Frame f = (Frame) dvals.get();
if ( f != null )
return f.clone();

@dmiller

dmiller Jan 14, 2012

Member

.clone() can't be null. looking at getThreadingBindingFrame, should probably be

Frame f = (Frame) dvals.get();
if ( f != null )
return f.clone();

+ if(f != null)
+ return f;
+ return new Frame();
+}
+
public static void resetThreadBindingFrame(Object frame){
dvals.set((Frame) frame);
}

0 comments on commit 12f07da

Please sign in to comment.