summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-05 22:37:55 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-05 22:37:55 +0000
commit3c1a077f65ea4759c2efd51ff2290e56df4af72f (patch)
tree4ac6c42bec73e41a74796954ca2753529f899d39
parentdd0f22f9cbf592d3ae17b03708ab66b4be7e6640 (diff)
merges a part of r31717 and a part of r31742.
Fixes a problem in Tk.mainloop. -- * ext/tk/lib/tk.rb: hang-up at exit before calling Tk.mainloop. -- * ext/tk/lib/tk.rb: fail to start Tk.mainloop (exit immediately) on some environment (reported on [ruby-talk:381444]). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@31928 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog9
-rw-r--r--ext/tk/lib/tk.rb44
-rw-r--r--version.h8
3 files changed, 51 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index d5e1728b61..09cc92f934 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Fri May 27 08:35:04 2011 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb: hang-up at exit before calling Tk.mainloop.
+
+Tue May 24 07:06:34 2011 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb: fail to start Tk.mainloop (exit immediately) on
+ some environment (reported on [ruby-talk:381444]).
+
Sat Jan 22 11:49:55 2011 Aaron Patterson <aaron@tenderlovemaking.com>
* ext/psych/lib/psych/visitors/to_ruby.rb: fixing merge key support
diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb
index 4beaaf932a..87ed2a449e 100644
--- a/ext/tk/lib/tk.rb
+++ b/ext/tk/lib/tk.rb
@@ -1236,6 +1236,9 @@ module TkCore
raise e
end
+ interp.mainloop_abort_on_exception = true
+ Thread.current.instance_variable_set("@interp", interp)
+
status = [nil]
def status.value
self[0]
@@ -1271,26 +1274,32 @@ proc __startup_rbtk_mainloop__ {args} {
}
set __initial_state_of_rubytk__ 1
trace add variable __initial_state_of_rubytk__ unset __startup_rbtk_mainloop__
+
+# complete initializing
+ruby {TkCore::INTERP_THREAD[:interp] = TkCore::INTERP_THREAD.instance_variable_get('@interp')}
EOS
begin
begin
#TclTkLib.mainloop_abort_on_exception = false
+ #interp.mainloop_abort_on_exception = true
+ #Thread.current[:interp] = interp
#Thread.current[:status].value = TclTkLib.mainloop(true)
- interp.mainloop_abort_on_exception = true
- Thread.current[:interp] = interp
Thread.current[:status].value = interp.mainloop(true)
rescue SystemExit=>e
Thread.current[:status].value = e
rescue Exception=>e
Thread.current[:status].value = e
+ p e if $DEBUG
retry if interp.has_mainwindow?
ensure
INTERP_MUTEX.synchronize{ INTERP_ROOT_CHECK.broadcast }
end
- #Thread.current[:status].value = TclTkLib.mainloop(false)
- Thread.current[:status].value = interp.mainloop(false)
+ unless interp.deleted?
+ #Thread.current[:status].value = TclTkLib.mainloop(false)
+ Thread.current[:status].value = interp.mainloop(false)
+ end
ensure
# interp must be deleted before the thread for interp is dead.
@@ -1300,12 +1309,20 @@ EOS
end
}
+ # check a Tcl/Tk interpreter is initialized
until INTERP_THREAD[:interp]
- Thread.pass
+ # Thread.pass
+ INTERP_THREAD.run
end
+
# INTERP_THREAD.run
raise INTERP_THREAD[:interp] if INTERP_THREAD[:interp].kind_of? Exception
+ # check an eventloop is running
+ while INTERP_THREAD.alive? && TclTkLib.mainloop_thread?.nil?
+ INTERP_THREAD.run
+ end
+
INTERP = INTERP_THREAD[:interp]
INTERP_THREAD_STATUS = INTERP_THREAD[:status]
@@ -1316,6 +1333,9 @@ EOS
INTERP_THREAD.kill
end
}
+
+ # (for safety's sake) force the eventloop to run
+ INTERP_THREAD.run
end
def INTERP.__getip
@@ -1845,6 +1865,11 @@ EOS
begin
TclTkLib.set_eventloop_window_mode(true)
+
+ # force run the eventloop
+ TkCore::INTERP._eval_without_enc('update')
+ TkCore::INTERP._eval_without_enc('catch {set __initial_state_of_rubytk__}')
+ INTERP_THREAD.run
if check_root
INTERP_MUTEX.synchronize{
INTERP_ROOT_CHECK.wait(INTERP_MUTEX)
@@ -1855,8 +1880,15 @@ EOS
end
}
else
- INTERP_THREAD.value
+ # INTERP_THREAD.value
+ begin
+ INTERP_THREAD.value
+ rescue Exception => e
+ raise e
+ end
end
+ rescue Exception => e
+ raise e
ensure
TclTkLib.set_eventloop_window_mode(false)
end
diff --git a/version.h b/version.h
index 4a6cf339b9..dffca7657a 100644
--- a/version.h
+++ b/version.h
@@ -1,13 +1,13 @@
#define RUBY_VERSION "1.9.2"
-#define RUBY_PATCHLEVEL 271
+#define RUBY_PATCHLEVEL 272
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 9
#define RUBY_VERSION_TEENY 1
#define RUBY_RELEASE_YEAR 2011
-#define RUBY_RELEASE_MONTH 5
-#define RUBY_RELEASE_DAY 31
-#define RUBY_RELEASE_DATE "2011-05-31"
+#define RUBY_RELEASE_MONTH 6
+#define RUBY_RELEASE_DAY 6
+#define RUBY_RELEASE_DATE "2011-06-06"
#include "ruby/version.h"