chiark / gitweb /
sd-bus: when the server-side disconnects, make sure to dispatch all tracking objects...
[elogind.git] / src / libelogind / sd-bus / sd-bus.c
index b4a5c554c6ef8b78d32a93bd39b0f3b0cc653615..0b8d2fffdf6ee41430e238d2db15e5c1700b0048 100644 (file)
@@ -109,6 +109,7 @@ static void bus_free(sd_bus *b) {
 
         assert(b);
         assert(!b->track_queue);
+        assert(!b->tracks);
 
         b->state = BUS_CLOSED;
 
@@ -2730,6 +2731,12 @@ static int process_closing(sd_bus *bus, sd_bus_message **ret) {
         if (c)
                 return process_closing_reply_callback(bus, c);
 
+        /* Then, fake-drop all remaining bus tracking references */
+        if (bus->tracks) {
+                bus_track_close(bus->tracks);
+                return 1;
+        }
+
         /* Then, synthesize a Disconnected message */
         r = sd_bus_message_new_signal(
                         bus,