Handle SIGCHLD in ibus-ui-gtk to fix issue 191.
authorHuang Peng <shawn.p.huang@gmail.com>
Sun, 23 Nov 2008 05:50:58 +0000 (13:50 +0800)
committerHuang Peng <shawn.p.huang@gmail.com>
Sun, 23 Nov 2008 05:50:58 +0000 (13:50 +0800)
ui/gtk/panel.py

index cb9353cdbb15b28b8cd18872539928f3926eee6f..bb618902966aaf3c7afb0e9fcbb583328eeebe44 100644 (file)
@@ -26,6 +26,7 @@ import ibus
 import icon as _icon
 import os
 import sys
+import signal
 from os import path
 from ibus import interface
 from languagebar import LanguageBar
@@ -62,6 +63,9 @@ class Panel(ibus.PanelBase):
         self.__ibus_icon = path.join(self.__icons_dir, "ibus.svg")
         self.__setup_cmd = path.join(self.__prefix, "bin", "ibus-setup")
 
+        # hanlder signal
+        signal.signal(signal.SIGCHLD, self.__sigchld_cb)
+
         # connect bus signal
         self.__bus.connect("config-value-changed", self.__config_value_changed_cb)
         self.__bus.connect("config-reloaded", self.__config_reloaded_cb)
@@ -365,6 +369,11 @@ class Panel(ibus.PanelBase):
             self.__bus.kill()
         else:
             print >> sys.stderr, "Unknown command %s" % command
+    
+    def __sigchld_cb(self, sig, sf):
+        pid = os.wait()
+        if self.__setup_pid == pid:
+            self.__setup_pid = 0
 
     def __start_setup(self):
         if self.__setup_pid != 0: