[rygel] core: Prevent possible crash on Ctrl-C



commit 13c124588b9775b057d61efe223521c409e2d3cc
Author: Jens Georg <mail jensge org>
Date:   Tue Jan 18 20:33:07 2011 +0100

    core: Prevent possible crash on Ctrl-C

 src/rygel/rygel-main.vala |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/rygel/rygel-main.vala b/src/rygel/rygel-main.vala
index 1753c2b..f729c5b 100644
--- a/src/rygel/rygel-main.vala
+++ b/src/rygel/rygel-main.vala
@@ -187,9 +187,14 @@ public class Rygel.Main : Object {
             device.available = plugin.active &&
                                this.config.get_upnp_enabled ();
 
-            this.root_devices.add (device);
+            // Due to pure evilness of unix sinals this might actually happen
+            // if someone shuts down rygel while the call-back is running,
+            // leading to a crash on shutdown
+            if (this.root_devices != null) {
+                this.root_devices.add (device);
 
-            plugin.notify["active"].connect (this.on_plugin_active_notify);
+                plugin.notify["active"].connect (this.on_plugin_active_notify);
+            }
         } catch (GLib.Error error) {
             warning (_("Failed to create RootDevice for %s. Reason: %s"),
                      plugin.name,



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