]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
bus: when destroying a bus, also destroy per-unit bus track objects associated with it
authorLennart Poettering <lennart@poettering.net>
Wed, 7 Feb 2018 21:40:41 +0000 (22:40 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 12 Feb 2018 10:34:00 +0000 (11:34 +0100)
Let's not keep the old bus object pinned this way, let's destroy all
relevant trackers for units, the way we already destroy them for jobs.

src/core/dbus.c

index 5e6dd0dee56ac991db53753892041e758aa4e60a..c7c96a3409869c7c0f8c748caf3f9d3c3ed55e86 100644 (file)
@@ -1087,6 +1087,10 @@ static void destroy_bus(Manager *m, sd_bus **bus) {
                 if (j->bus_track && sd_bus_track_get_bus(j->bus_track) == *bus)
                         j->bus_track = sd_bus_track_unref(j->bus_track);
 
+        HASHMAP_FOREACH(u, m->units, i)
+                if (u->bus_track && sd_bus_track_get_bus(u->bus_track) == *bus)
+                        u->bus_track = sd_bus_track_unref(u->bus_track);
+
         /* Get rid of queued message on this bus */
         if (m->queued_message && sd_bus_message_get_bus(m->queued_message) == *bus)
                 m->queued_message = sd_bus_message_unref(m->queued_message);