← Back to team overview

ayatana-commits team mailing list archive

[Merge] lp:~ted/libindicate/proxies-removed into lp:libindicate

 

Ted Gould has proposed merging lp:~ted/libindicate/proxies-removed into lp:libindicate.

    Requested reviews:
    Indicator Applet Developers (indicator-applet-developers)


This patch makes it so when the proxy is destroyed we clean up and
mention that the server has been removed.

-- 
https://code.launchpad.net/~ted/libindicate/proxies-removed/+merge/18902
Your team ayatana-commits is subscribed to branch lp:libindicate.
=== modified file 'libindicate/listener.c'
--- libindicate/listener.c	2010-02-04 23:06:48 +0000
+++ libindicate/listener.c	2010-02-09 04:41:11 +0000
@@ -394,6 +394,18 @@
 	return;
 }
 
+/* This is the callback for when the proxy, which is attached
+   to the name owner, is destroy (they fell off the bus) we handle
+   that and free up our memory too. */
+void
+proxy_destroyed (GObject * proxy, gpointer user_data)
+{
+	proxy_t * proxyt = (proxy_t *)user_data;
+	proxyt->proxy = NULL; /* Clear this so we don't get a double free on this guy */
+	proxy_struct_destroy(proxyt);
+	return;
+}
+
 gboolean
 todo_idle (gpointer data)
 {
@@ -461,14 +473,14 @@
 	                                                INDICATE_DBUS_IFACE,
 	                                                &error);
 
-	g_free(todo);
-
 	if (error != NULL) {
 		g_warning("Unable to create proxy for %s", proxyt->name);
 		g_error_free(error);
 		return TRUE;
 	}
 
+	g_signal_connect(G_OBJECT(proxyt->proxy), "destroy", G_CALLBACK(proxy_destroyed), proxyt);
+
 	/* Making sure the server has the proxy as well */
 	proxyt->server.proxy = proxyt->proxy;
 


Follow ups