bus: make sure an additional ref to a busevent source doesn't cause the event source...
authorLennart Poettering <lennart@poettering.net>
Wed, 20 Nov 2013 17:18:09 +0000 (18:18 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 20 Nov 2013 19:58:17 +0000 (20:58 +0100)
src/libsystemd-bus/sd-bus.c

index bc88ac9..72d04d2 100644 (file)
@@ -2626,17 +2626,25 @@ _public_ int sd_bus_detach_event(sd_bus *bus) {
         assert_return(bus, -EINVAL);
         assert_return(bus->event, -ENXIO);
 
-        if (bus->input_io_event_source)
+        if (bus->input_io_event_source) {
+                sd_event_source_set_enabled(bus->input_io_event_source, SD_EVENT_OFF);
                 bus->input_io_event_source = sd_event_source_unref(bus->input_io_event_source);
+        }
 
-        if (bus->output_io_event_source)
+        if (bus->output_io_event_source) {
+                sd_event_source_set_enabled(bus->output_io_event_source, SD_EVENT_OFF);
                 bus->output_io_event_source = sd_event_source_unref(bus->output_io_event_source);
+        }
 
-        if (bus->time_event_source)
+        if (bus->time_event_source) {
+                sd_event_source_set_enabled(bus->time_event_source, SD_EVENT_OFF);
                 bus->time_event_source = sd_event_source_unref(bus->time_event_source);
+        }
 
-        if (bus->quit_event_source)
+        if (bus->quit_event_source) {
+                sd_event_source_set_enabled(bus->quit_event_source, SD_EVENT_OFF);
                 bus->quit_event_source = sd_event_source_unref(bus->quit_event_source);
+        }
 
         if (bus->event)
                 bus->event = sd_event_unref(bus->event);