diff --git a/vm/builtin/nativemethod.cpp b/vm/builtin/nativemethod.cpp index 38a7400..1f1084b 100644 @@ -181,7 +181,7 @@ namespace rubinius { } Object* NativeMethodEnvironment::block() { - return current_block_; + return current_block_.get(); } capi::HandleList& NativeMethodEnvironment::handles() { @@ -216,7 +216,7 @@ namespace rubinius { } void NativeMethod::init_thread(STATE) { - NativeMethodEnvironment* env = new NativeMethodEnvironment; + NativeMethodEnvironment* env = new NativeMethodEnvironment(state); env->set_state(state); native_method_environment.set(env); } diff --git a/vm/builtin/nativemethod.hpp b/vm/builtin/nativemethod.hpp index 64d14d8..1d1187a 100644 @@ -38,9 +38,14 @@ namespace rubinius { /** Current native callframe. */ NativeMethodFrame* current_native_frame_; ExceptionPoint* current_ep_; - Object* current_block_; + TypedRoot<Object*> current_block_; public: /* Class Interface */ + NativeMethodEnvironment(STATE) + : current_block_(state) + { + current_block_.set(Qnil); + } /** Obtain the NativeMethodEnvironment for this thread. */ static NativeMethodEnvironment* get(); @@ -65,7 +70,7 @@ namespace rubinius { Object* block(); void set_current_block(Object* block) { - current_block_ = block; + current_block_.set(block); } void set_state(VM* vm) {

