Diff between 29db85bf38ab26b459159dcf42d842f35c6e13a2 and 5c8be87889353cf6fb5dc079fa2a1b9fe7393e62

Changed Files

File Additions Deletions Status
thermometer/thermometer.c +10 -1 modified

Full Patch

diff --git a/thermometer/thermometer.c b/thermometer/thermometer.c
index 9513fcd..52f7535 100644
--- a/thermometer/thermometer.c
+++ b/thermometer/thermometer.c
@@ -554,7 +554,16 @@ static void disable_final_measurement(struct thermometer *t)
 
 static void watcher_exit(DBusConnection *conn, void *user_data)
 {
-	/* TODO: Watcher disconnected */
+	struct watcher *watcher = user_data;
+	struct thermometer *t = watcher->t;
+
+	DBG("Thermometer watcher %s disconnected", watcher->path);
+
+	t->fwatchers = g_slist_remove(t->fwatchers, watcher);
+	watcher->id = 0;
+
+	if (g_slist_length(t->fwatchers) == 0)
+		disable_final_measurement(t);
 }
 
 static struct watcher *find_watcher(struct thermometer *t, const gchar *sender,