[farsight2/master] Disconnect signal when stopping upnp discovery

Olivier Crête olivier.crete at collabora.co.uk
Tue Dec 23 15:26:48 PST 2008


---
 transmitters/rawudp/fs-rawudp-component.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/transmitters/rawudp/fs-rawudp-component.c b/transmitters/rawudp/fs-rawudp-component.c
index f7eb35a..5037d1c 100644
--- a/transmitters/rawudp/fs-rawudp-component.c
+++ b/transmitters/rawudp/fs-rawudp-component.c
@@ -160,6 +160,8 @@ struct _FsRawUdpComponentPrivate
 #ifdef HAVE_GUPNP
   GSource *upnp_discovery_timeout_src;
   FsCandidate *local_upnp_candidate;
+
+  gulong upnp_signal_id;
 #endif
 };
 
@@ -1103,6 +1105,13 @@ fs_rawudp_component_stop_upnp_discovery_locked (FsRawUdpComponent *self)
     g_source_unref (self->priv->upnp_discovery_timeout_src);
   }
   self->priv->upnp_discovery_timeout_src = NULL;
+
+  if (self->priv->upnp_signal_id)
+  {
+    g_signal_handler_disconnect (self->priv->upnp_igd,
+        self->priv->upnp_signal_id);
+    self->priv->upnp_signal_id = 0;
+  }
 }
 
 #endif
@@ -1144,8 +1153,11 @@ fs_rawudp_component_gather_local_candidates (FsRawUdpComponent *self,
 
       if (self->priv->upnp_discovery)
       {
-        g_signal_connect (self->priv->upnp_igd, "mapped-external-port",
+        FS_RAWUDP_COMPONENT_LOCK (self);
+        self->priv->upnp_signal_id = g_signal_connect (self->priv->upnp_igd,
+            "mapped-external-port",
             G_CALLBACK (_upnp_mapped_external_port), self);
+        FS_RAWUDP_COMPONENT_UNLOCK (self);
       }
 
       gupnp_simple_igd_add_port (GUPNP_SIMPLE_IGD (self->priv->upnp_igd),
-- 
1.5.6.5




More information about the farsight-commits mailing list