[farsight2/master] nice: Don't let agent thread try to join self

Olivier Crête olivier.crete at collabora.co.uk
Thu Jul 16 15:04:16 PDT 2009


---
 transmitters/nice/fs-nice-agent.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/transmitters/nice/fs-nice-agent.c b/transmitters/nice/fs-nice-agent.c
index 6450e64..a29dd8c 100644
--- a/transmitters/nice/fs-nice-agent.c
+++ b/transmitters/nice/fs-nice-agent.c
@@ -281,17 +281,18 @@ fs_nice_agent_stop_thread (FsNiceAgent *self)
 {
   GSource *idle_source;
 
+  g_main_loop_quit (self->priv->main_loop);
+
   FS_NICE_AGENT_LOCK(self);
 
-  if (self->priv->thread == NULL)
+  if (self->priv->thread == NULL ||
+      self->priv->thread == g_thread_self ())
   {
     FS_NICE_AGENT_UNLOCK (self);
     return;
   }
   FS_NICE_AGENT_UNLOCK (self);
 
-  g_main_loop_quit (self->priv->main_loop);
-
   idle_source = g_idle_source_new ();
   g_source_set_priority (idle_source, G_PRIORITY_HIGH);
   g_source_set_callback (idle_source, thread_unlock_idler, self, NULL);
-- 
1.5.6.5




More information about the farsight-commits mailing list