summaryrefslogtreecommitdiff
path: root/vm_backtrace.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-29 22:35:09 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-29 22:35:09 +0000
commit0c3f23ae7c60798e1c40421eb2924bcd1e063f25 (patch)
treeb447a7171fd3beb085fc16491ca66b329a5d1f8a /vm_backtrace.c
parent4db83403982100df21c3c6c18b1cef29dd379e6a (diff)
* vm_backtrace.c: add GC guards.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_backtrace.c')
-rw-r--r--vm_backtrace.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/vm_backtrace.c b/vm_backtrace.c
index 6a43fbf..97b38bc 100644
--- a/vm_backtrace.c
+++ b/vm_backtrace.c
@@ -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