bus: when destroying a bus, also destroy per-unit bus track objects associated with it

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.
This commit is contained in:
Lennart Poettering
2018-02-12 11:34:00 +01:00
parent 5f109056d5
commit dfeff66499
+4
View 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);