diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c index bc88ac977c9..72d04d28f15 100644 --- a/src/libsystemd-bus/sd-bus.c +++ b/src/libsystemd-bus/sd-bus.c @@ -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);