[rygel] core: Prevent dead-lock in signal handler



commit 0dad99ae37bad7f8b47a338b0094ecb39d5ff32b
Author: Jens Georg <mail jensge org>
Date:   Mon Nov 14 22:08:31 2011 +0100

    core: Prevent dead-lock in signal handler

 src/rygel/rygel-signal-handler.vala |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/src/rygel/rygel-signal-handler.vala b/src/rygel/rygel-signal-handler.vala
index 5ef3728..d1c0159 100644
--- a/src/rygel/rygel-signal-handler.vala
+++ b/src/rygel/rygel-signal-handler.vala
@@ -48,10 +48,26 @@ public class Rygel.SignalHandler : GLib.Object {
     }
 
     private static void signal_handler (int signum) {
+        if (main == null) {
+            debug ("Signal handler already called, ignoring");
+
+            return;
+        }
+
         if (signum == SIGHUP) {
-            main.restart ();
+            Idle.add (() => {
+                main.restart ();
+
+                return false;
+            });
         } else {
-            main.exit (0);
+            Idle.add (() => {
+                if (main != null) {
+                    main.exit (0);
+                }
+
+                return false;
+            });
         }
     }
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]