Skip to content

Commit 2a128fa

Browse files
committed
Reference fixes.
1 parent be664dd commit 2a128fa

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/libcore/arc.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,14 @@ impl methods<T> for exclusive<T> {
102102
fn with<U>(f: fn(sys::condition, x: &T) -> U) -> U {
103103
unsafe {
104104
let ptr: ~arc_data<ex_data<T>> = unsafe::reinterpret_cast(*self);
105-
let rec: &ex_data<T> = &(*ptr).data;
105+
let r = {
106+
let rec: &ex_data<T> = &(*ptr).data;
107+
rec.lock.lock_cond() {|c|
108+
f(c, &rec.data)
109+
}
110+
};
106111
unsafe::forget(ptr);
107-
rec.lock.lock_cond() {|c|
108-
f(c, &rec.data)
109-
}
112+
r
110113
}
111114
}
112115
}

0 commit comments

Comments
 (0)