ruby-changes:5861
From: nagai <ko1@a...>
Date: Tue, 17 Jun 2008 01:58:58 +0900 (JST)
Subject: [ruby-changes:5861] Ruby:r17368 (trunk): * ext/tk/tcltklib.c: SEGV when exit.
nagai 2008-06-17 01:54:50 +0900 (Tue, 17 Jun 2008)
New Revision: 17368
Modified files:
trunk/ChangeLog
trunk/ext/tk/lib/tk.rb
trunk/ext/tk/sample/irbtkw.rbw
trunk/ext/tk/tcltklib.c
Log:
* ext/tk/tcltklib.c: SEGV when exit.
* ext/tk/lib/tk.rb: add a check for safety to Tk.exit.
* ext/tk/sample/irbtkw.rbw: freezes when receives SIGINT.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ext/tk/sample/irbtkw.rbw?r1=17368&r2=17367&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ext/tk/lib/tk.rb?r1=17368&r2=17367&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=17368&r2=17367&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ext/tk/tcltklib.c?r1=17368&r2=17367&diff_format=u
Index: ChangeLog
===================================================================
--- ChangeLog (revision 17367)
+++ ChangeLog (revision 17368)
@@ -1,3 +1,11 @@
+Tue Jun 17 01:52:50 2008 Hidetoshi NAGAI <nagai@a...>
+
+ * ext/tk/tcltklib.c: SEGV when exit.
+
+ * ext/tk/lib/tk.rb: add a check for safety to Tk.exit.
+
+ * ext/tk/sample/irbtkw.rbw: freezes when receives SIGINT.
+
Mon Jun 16 21:58:38 2008 Nobuyoshi Nakada <nobu@r...>
* ext/stringio/stringio.c (strio_each, strio_readlines): IO#each and
Index: ext/tk/sample/irbtkw.rbw
===================================================================
--- ext/tk/sample/irbtkw.rbw (revision 17367)
+++ ext/tk/sample/irbtkw.rbw (revision 17368)
@@ -48,10 +48,20 @@
:side=>:right,
:expand=>false,
:fill=>:y))
+
+# save original I/O
+out = $stdout
+err = $stderr
+
irb_thread = nil
ev_loop = Thread.new{
- Tk.mainloop
- irb_thread.kill if irb_thread
+ begin
+ Tk.mainloop
+ ensure
+ $stdout = out
+ $stderr = err
+ irb_thread.kill if irb_thread
+ end
}
# window position control
@@ -142,5 +152,5 @@
irb_thread.join
# exit
-ev_thread.kill
+ev_loop.kill
Tk.exit
Index: ext/tk/tcltklib.c
===================================================================
--- ext/tk/tcltklib.c (revision 17367)
+++ ext/tk/tcltklib.c (revision 17368)
@@ -4,7 +4,7 @@
* Oct. 24, 1997 Y. Matsumoto
*/
-#define TCLTKLIB_RELEASE_DATE "2008-06-12"
+#define TCLTKLIB_RELEASE_DATE "2008-06-17"
#include "ruby.h"
@@ -448,7 +448,7 @@
#ifdef RUBY_USE_NATIVE_THREAD
#define DEFAULT_EVENT_LOOP_MAX 800/*counts*/
#define DEFAULT_NO_EVENT_TICK 10/*counts*/
-#define DEFAULT_NO_EVENT_WAIT 10/*milliseconds ( 1 -- 999 ) */
+#define DEFAULT_NO_EVENT_WAIT 1/*milliseconds ( 1 -- 999 ) */
#define WATCHDOG_INTERVAL 10/*milliseconds ( 1 -- 999 ) */
#define DEFAULT_TIMER_TICK 0/*milliseconds ( 0 -- 999 ) */
#define NO_THREAD_INTERRUPT_TIME 100/*milliseconds ( 1 -- 999 ) */
@@ -1555,6 +1555,10 @@
{
struct timeval t;
+ if (no_event_wait <= 0) {
+ return Qnil;
+ }
+
t.tv_sec = (time_t)0;
t.tv_usec = (time_t)(no_event_wait*1000.0);
@@ -5096,7 +5100,7 @@
}
/* delete root widget */
-#if 1
+#if 0 /* cause SEGV on Ruby 1.9 */
DUMP1("check `destroy'");
if (Tcl_GetCommandInfo(ip, "destroy", &info)) {
DUMP1("call `destroy .'");
Index: ext/tk/lib/tk.rb
===================================================================
--- ext/tk/lib/tk.rb (revision 17367)
+++ ext/tk/lib/tk.rb (revision 17368)
@@ -1110,7 +1110,7 @@
extend TkComm
WITH_RUBY_VM = Object.const_defined?(:VM) && ::VM.class == Class
- WITH_ENCODING = defined?(::Encoding.default_external)
+ WITH_ENCODING = defined?(::Encoding.default_external) && true
#WITH_ENCODING = Object.const_defined?(:Encoding) && ::Encoding.class == Class
unless self.const_defined? :RUN_EVENTLOOP_ON_MAIN_THREAD
@@ -2174,7 +2174,7 @@
end
def Tk.exit
- tk_call_without_enc('destroy', '.')
+ TkCore::INTERP.has_mainwindow? && tk_call_without_enc('destroy', '.')
end
################################################
@@ -5501,7 +5501,7 @@
#Tk.freeze
module Tk
- RELEASE_DATE = '2008-06-11'.freeze
+ RELEASE_DATE = '2008-06-17'.freeze
autoload :AUTO_PATH, 'tk/variable'
autoload :TCL_PACKAGE_PATH, 'tk/variable'
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/