From 023a34526bed14f11d66b1e0998de061e34e8a3b Mon Sep 17 00:00:00 2001 From: nagai Date: Sun, 31 Jan 2010 22:50:43 +0000 Subject: * ext/tk/tkutil/tkutil.c: fix SEGV on TkUtil::CallbackSubst._setup_subst_table. * ext/tk/lib/tk.rb: [ruby1.9] fix freeze at exit. * ext/tk/lib/tk.rb: [POTENTIAL INCOMPATIBLE] return NoMethodError for TkWindow#to_ary and to_str. * ext/tk/lib/tkextlib/tcllib/plotchart.rb: wrong arguments. * ext/tk/sampel/tkballoonhelp.rb: fail to support TkEntry widgets. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/tk/lib/tk.rb | 12 +++++++++++- ext/tk/lib/tkextlib/tcllib/plotchart.rb | 4 ++-- ext/tk/sample/tkballoonhelp.rb | 18 +++++++++++++++--- ext/tk/tkutil/tkutil.c | 20 ++++++++++---------- 4 files changed, 38 insertions(+), 16 deletions(-) (limited to 'ext') diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb index 7552abed91..f17a6af4d2 100644 --- a/ext/tk/lib/tk.rb +++ b/ext/tk/lib/tk.rb @@ -1174,6 +1174,8 @@ module TkCore opts = '' end + # RUN_EVENTLOOP_ON_MAIN_THREAD = true + unless self.const_defined? :RUN_EVENTLOOP_ON_MAIN_THREAD if WITH_RUBY_VM ### check Ruby 1.9 !!!!!!! # *** NEED TO FIX *** @@ -1275,6 +1277,14 @@ module TkCore INTERP = INTERP_THREAD[:interp] INTERP_THREAD_STATUS = INTERP_THREAD[:status] + + # delete the interpreter and kill the eventloop thread at exit + END{ + if INTERP_THREAD.alive? + INTERP.delete + INTERP_THREAD.kill + end + } end def INTERP.__getip @@ -4890,7 +4900,7 @@ class TkObjectaliases = aliases; - return inf; + if (inf_ptr != (struct cbsubst_info **)NULL) *inf_ptr = inf; + + return Data_Wrap_Struct(cSUBST_INFO, subst_mark, subst_free, inf); } static void cbsubst_init() { - rb_const_set(cCB_SUBST, ID_SUBST_INFO, - Data_Wrap_Struct(cSUBST_INFO, subst_mark, subst_free, - allocate_cbsubst_info())); + rb_const_set(cCB_SUBST, ID_SUBST_INFO, + allocate_cbsubst_info((struct cbsubst_info **)NULL)); } static VALUE @@ -1517,6 +1518,7 @@ cbsubst_table_setup(argc, argv, self) VALUE *argv; VALUE self; { + volatile VALUE cbsubst_obj; volatile VALUE key_inf; volatile VALUE longkey_inf; volatile VALUE proc_inf; @@ -1538,7 +1540,7 @@ cbsubst_table_setup(argc, argv, self) } /* init */ - subst_inf = allocate_cbsubst_info(); + cbsubst_obj = allocate_cbsubst_info(&subst_inf); /* * keys : array of [subst, type, ivar] @@ -1625,9 +1627,7 @@ cbsubst_table_setup(argc, argv, self) RARRAY_PTR(inf)[1]); } - rb_const_set(self, ID_SUBST_INFO, - Data_Wrap_Struct(cSUBST_INFO, subst_mark, - subst_free, subst_inf)); + rb_const_set(self, ID_SUBST_INFO, cbsubst_obj); return self; } -- cgit v1.2.3