diff options
author | Jean Boussier <jean.boussier@gmail.com> | 2020-04-03 15:28:06 +0200 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2020-08-19 08:13:09 -0700 |
commit | a74df67244199d1fd1f7a20b49dd5a096d2a13a2 (patch) | |
tree | 6a13cf2a124321b187312a8e833652276838a092 /ext | |
parent | 7d01d8811b47a5af1a4a43b69b7002216103f37d (diff) |
Fix ObjectSpace.trace_object_allocations_stop to not raise if the tracepoint were not initialized
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3001
Diffstat (limited to 'ext')
-rw-r--r-- | ext/objspace/object_tracing.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/ext/objspace/object_tracing.c b/ext/objspace/object_tracing.c index b6ffca8bd3..4973a7535b 100644 --- a/ext/objspace/object_tracing.c +++ b/ext/objspace/object_tracing.c @@ -290,8 +290,12 @@ trace_object_allocations_stop(VALUE self) } if (arg->running == 0) { - rb_tracepoint_disable(arg->newobj_trace); - rb_tracepoint_disable(arg->freeobj_trace); + if (arg->newobj_trace != 0) { + rb_tracepoint_disable(arg->newobj_trace); + } + if (arg->freeobj_trace != 0) { + rb_tracepoint_disable(arg->freeobj_trace); + } } return Qnil; |