From 13c124588b9775b057d61efe223521c409e2d3cc Mon Sep 17 00:00:00 2001 From: Jens Georg Date: Tue, 18 Jan 2011 20:33:07 +0100 Subject: [PATCH] core: Prevent possible crash on Ctrl-C --- src/rygel/rygel-main.vala | 9 +++++++-- 1 file 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, -- 2.7.4