mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* vm_backtrace.c: add GC guards.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4db8340398
commit
0c3f23ae7c
2 changed files with 20 additions and 4 deletions
|
@ -1,3 +1,7 @@
|
|||
Fri Nov 30 07:34:28 2012 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* vm_backtrace.c: add GC guards.
|
||||
|
||||
Fri Nov 30 07:21:33 2012 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
[EXPERIMENTAL: NEED DISCUSS]
|
||||
|
|
|
@ -499,6 +499,8 @@ backtrace_to_str_ary(VALUE self, long lev, long n)
|
|||
{
|
||||
rb_backtrace_t *bt;
|
||||
int size;
|
||||
VALUE r;
|
||||
|
||||
GetCoreDataFromValue(self, rb_backtrace_t, bt);
|
||||
size = bt->backtrace_size;
|
||||
|
||||
|
@ -509,7 +511,9 @@ backtrace_to_str_ary(VALUE self, long lev, long n)
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
return backtrace_collect(bt, lev, n, location_to_str_dmyarg, 0);
|
||||
r = backtrace_collect(bt, lev, n, location_to_str_dmyarg, 0);
|
||||
RB_GC_GUARD_PTR(&self);
|
||||
return r;
|
||||
}
|
||||
|
||||
VALUE
|
||||
|
@ -542,6 +546,8 @@ backtrace_to_location_ary(VALUE self, long lev, long n)
|
|||
{
|
||||
rb_backtrace_t *bt;
|
||||
int size;
|
||||
VALUE r;
|
||||
|
||||
GetCoreDataFromValue(self, rb_backtrace_t, bt);
|
||||
size = bt->backtrace_size;
|
||||
|
||||
|
@ -552,7 +558,9 @@ backtrace_to_location_ary(VALUE self, long lev, long n)
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
return backtrace_collect(bt, lev, n, location_create, (void *)self);
|
||||
r = backtrace_collect(bt, lev, n, location_create, (void *)self);
|
||||
RB_GC_GUARD_PTR(&self);
|
||||
return r;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
@ -706,7 +714,9 @@ vm_backtrace_to_ary(rb_thread_t *th, int argc, VALUE *argv, int lev_default, int
|
|||
VALUE level, vn;
|
||||
long lev, n;
|
||||
VALUE btval = backtrace_object(th);
|
||||
VALUE r;
|
||||
rb_backtrace_t *bt;
|
||||
|
||||
GetCoreDataFromValue(btval, rb_backtrace_t, bt);
|
||||
|
||||
rb_scan_args(argc, argv, "02", &level, &vn);
|
||||
|
@ -755,11 +765,13 @@ vm_backtrace_to_ary(rb_thread_t *th, int argc, VALUE *argv, int lev_default, int
|
|||
}
|
||||
|
||||
if (to_str) {
|
||||
return backtrace_to_str_ary(btval, lev, n);
|
||||
r = backtrace_to_str_ary(btval, lev, n);
|
||||
}
|
||||
else {
|
||||
return backtrace_to_location_ary(btval, lev, n);
|
||||
r = backtrace_to_location_ary(btval, lev, n);
|
||||
}
|
||||
RB_GC_GUARD_PTR(&btval);
|
||||
return r;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
|
Loading…
Reference in a new issue