1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-07 01:27:11 +03:00

bus: make sure an additional ref to a busevent source doesn't cause the event source to be triggered again

This commit is contained in:
Lennart Poettering 2013-11-20 18:18:09 +01:00
parent 2576a19ed2
commit 86befb4098

View 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);