daemon: Close plugin poxy on remote proxy dead.
authorAmarnath Valluri <amarnath.valluri@linux.intel.com>
Mon, 22 Jul 2013 10:29:03 +0000 (13:29 +0300)
committerAmarnath Valluri <amarnath.valluri@linux.intel.com>
Mon, 22 Jul 2013 17:29:45 +0000 (20:29 +0300)
src/daemon/plugins/gsignond-plugin-proxy.c

index 23dc999..7e2e225 100644 (file)
@@ -262,6 +262,18 @@ gsignond_plugin_proxy_status_changed_callback (
                                                 priv->active_process_userdata);
 }
 
+static void
+_on_remote_plugin_dead (gpointer data, GObject *dead_obj)
+{
+DBG("{");
+    GSignondPluginProxy *proxy = NULL;
+    if (data && (proxy = GSIGNOND_PLUGIN_PROXY(data))) {
+        proxy->priv->plugin = NULL;
+        g_object_unref (G_OBJECT(data));
+    }
+DBG("}");
+}
+
 static GObject *
 gsignond_plugin_proxy_constructor (
         GType                  gtype,
@@ -309,6 +321,8 @@ gsignond_plugin_proxy_constructor (
         }
         g_free (type);
 
+        g_object_weak_ref (G_OBJECT(priv->plugin), _on_remote_plugin_dead, obj);
+
     }
     return obj;
 }
@@ -379,6 +393,7 @@ gsignond_plugin_proxy_dispose (
         priv->active_session = NULL;
     }
     if (priv->plugin) {
+        g_object_weak_unref (G_OBJECT(priv->plugin), _on_remote_plugin_dead, self);
         g_object_unref (priv->plugin);
         priv->plugin = NULL;
     }