From: Masahiro S. ()
<sa...@to...> - 2003-07-26 11:45:13
|
さかいです。 From: Masao Mutoh <mu...@hi...> Subject: [ruby-gnome2-devel-ja] signal_connect Date: Sat, 26 Jul 2003 13:00:05 +0900 > むとうです。 > > 最近のsignal_connectってそのブロックの中でexitとかraise > とか書けなくなりましたよね。 > > ちょっと、gstreamerのサンプル見ていて気づいたのですが、 > 実際のところ、以下のような場合、どのようにプログラムを > 終了させるのが良いのでしょうか。 > > gstreamer/sample/audio-player.rbの32行目辺り > > typefind = Gst::ElementFactory.make("typefind") > typefind.signal_connect("have_type") do |typefind, caps| > $stderr.puts("GstPipeline: play have type") > pipeline.pause > cache.unlink_pads(typefind) > autobin.remove(typefind) > osssink = Gst::ElementFactory.make("osssink") > autoplug = Gst::AutoplugFactory.make("staticrender") > unless element = autoplug.to_renderers(caps, osssink) > puts "Could not autoplug, no suitable codecs found..." > exit 1 #ここ > end > element.name = "new element" > autobin.add(element) > cache.reset = true > cache.link_pads(element) > pipeline.play > end > > signal_connectの中でexitとかしたくなるパターンって > どうしてもあると思うのですが....。 確かに、SystemExitInterruptまで止めてしまうのは 問題が多そうですね。 どうするのが良いかは悩むのですが、 考えていると0.6リリースに間に合いそうにないので、 とりあえずは以前の振舞に戻しておきます。 -- 酒井 政裕 / Masahiro Sakai |