@@ -272,11 +272,9 @@ VALUE to_ruby_with_mode(SEXP robj, int mode)
272272 if (i < 0 ) return Qnil ;
273273 if (i == 1 ) break ;
274274 default :
275- R_References = CONS (robj , R_References );
276- SET_SYMVALUE (install ("R.References" ), R_References );
277-
275+ protect_robj (robj );
278276 obj = Data_Wrap_Struct (rb_const_get (rb_cObject ,
279- rb_intern ("RObj" )), 0 , 0 , robj );
277+ rb_intern ("RObj" )), 0 , & Robj_dealloc , robj );
280278 rb_iv_set (obj ,"@conversion" ,INT2FIX (TOP_MODE ));
281279 rb_iv_set (obj ,"@wrap" ,Qfalse );
282280 }
@@ -443,7 +441,7 @@ from_proc_table(SEXP robj, VALUE *fun)
443441 l = FIX2INT (rb_funcall (proc_table ,rb_intern ("size" ),0 ));
444442
445443 obj = Data_Wrap_Struct (rb_const_get (rb_cObject ,
446- rb_intern ("RObj" )), 0 , 0 , robj );
444+ rb_intern ("RObj" )), 0 , & Robj_dealloc , robj );
447445 rb_iv_set (obj ,"@conversion" ,INT2FIX (TOP_MODE ));
448446 rb_iv_set (obj ,"@wrap" ,Qfalse );
449447
@@ -506,7 +504,7 @@ to_ruby_proc(SEXP robj, VALUE *obj)
506504 //Create new object based on robj and call the function
507505 //found above with it as argument
508506 tmp = Data_Wrap_Struct (rb_const_get (rb_cObject ,
509- rb_intern ("RObj" )), 0 , 0 , robj );
507+ rb_intern ("RObj" )), 0 , & Robj_dealloc , robj );
510508 rb_iv_set (tmp ,"@conversion" ,INT2FIX (TOP_MODE ));
511509 rb_iv_set (tmp ,"@wrap" ,Qfalse );
512510
@@ -572,7 +570,7 @@ to_ruby_class(SEXP robj, VALUE *obj)
572570 return 0 ; /* conversion failed */
573571
574572 tmp = Data_Wrap_Struct (rb_const_get (rb_cObject ,
575- rb_intern ("RObj" )), 0 , 0 , robj );
573+ rb_intern ("RObj" )), 0 , & Robj_dealloc , robj );
576574 rb_iv_set (tmp ,"@conversion" ,INT2FIX (TOP_MODE ));
577575 rb_iv_set (tmp ,"@wrap" ,Qfalse );
578576
0 commit comments