diff --git a/thermometer/thermometer.c b/thermometer/thermometer.c
index 9513fcd..52f7535 100644
--- a/thermometer/thermometer.c
+++ b/thermometer/thermometer.c
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,