diff -ur subversion-1.3.1/subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.c subversion-1.3.1-emp/subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.c --- subversion-1.3.1/subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.c 2006-01-09 18:49:33.000000000 -0800 +++ subversion-1.3.1-emp/subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.c 2006-04-10 23:23:44.000000000 -0700 @@ -305,7 +305,9 @@ static VALUE rb_pool_new(VALUE parent) { - return rb_funcall(rb_svn_core_pool(), rb_id_new(), 1, parent); + VALUE pool = rb_funcall(rb_svn_core_pool(), rb_id_new(), 1, parent); + rb_ivar_set(pool, rb_id___batons__(), rb_ary_new()); + return pool; } static VALUE swig_type_re = Qnil; @@ -1331,10 +1333,13 @@ VALUE svn_swig_rb_make_baton(VALUE proc, VALUE pool) { + VALUE ret; if (NIL_P(proc)) { return Qnil; } else { - return rb_ary_new3(2, proc, pool); + ret = rb_ary_new3(2, proc, pool); + rb_ary_push(rb_ivar_get(pool, rb_id___batons__()), ret); + return ret; } } @@ -1345,6 +1350,9 @@ *proc = Qnil; *pool = Qnil; } else { + if(!RBASIC(baton)->flags) { + rb_raise(rb_eRuntimeError, "Baton at 0x%x has been incorrectly collected!", (void*)baton); + } *proc = rb_ary_entry(baton, 0); *pool = rb_ary_entry(baton, 1); }