diff options
Diffstat (limited to 'ext/tk/tkutil.c')
-rw-r--r-- | ext/tk/tkutil.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/ext/tk/tkutil.c b/ext/tk/tkutil.c index b3e79430dd..aaa77b1aa8 100644 --- a/ext/tk/tkutil.c +++ b/ext/tk/tkutil.c @@ -9,6 +9,7 @@ ************************************************/ #include "ruby.h" +#include "rubysig.h" #include "st.h" static VALUE cMethod; @@ -1133,6 +1134,13 @@ cbsubst_scan_args(self, arg_key, val_ary) char *ptr; volatile VALUE dst = rb_ary_new2(len); volatile VALUE proc; + int thr_crit_bup; + VALUE old_gc; + + thr_crit_bup = rb_thread_critical; + rb_thread_critical = Qtrue; + + old_gc = rb_gc_disable(); Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO), struct cbsubst_info, inf); @@ -1161,6 +1169,9 @@ cbsubst_scan_args(self, arg_key, val_ary) } } + if (old_gc == Qfalse) rb_gc_enable(); + rb_thread_critical = thr_crit_bup; + return dst; } |