diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-05-15 17:08:24 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-05-15 17:13:05 +0200 |
commit | 1b64f8382956cdd9a2afc50a7ab638529acb912e (patch) | |
tree | 2880fcfabf5fb6ed9f41d25d08a9ae00cadc4a6a /src/libsystemd/sd-bus/bus-match.c | |
parent | 4a134c4903dbf6ef6c6ad55780643a5dd816d349 (diff) |
sd-bus: always keep slot reference while dispatching callback
Also, make sure we automatically destroy reply callbacks that are
floating.
Diffstat (limited to 'src/libsystemd/sd-bus/bus-match.c')
-rw-r--r-- | src/libsystemd/sd-bus/bus-match.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/libsystemd/sd-bus/bus-match.c b/src/libsystemd/sd-bus/bus-match.c index b868159b5c..3391b1a1b6 100644 --- a/src/libsystemd/sd-bus/bus-match.c +++ b/src/libsystemd/sd-bus/bus-match.c @@ -290,16 +290,15 @@ int bus_match_run( /* Run the callback. And then invoke siblings. */ if (node->leaf.callback) { - sd_bus_slot *slot; - _cleanup_bus_error_free_ sd_bus_error error_buffer = SD_BUS_ERROR_NULL; + sd_bus_slot *slot; slot = container_of(node->leaf.callback, sd_bus_slot, match_callback); if (bus) - bus->current_slot = slot; + bus->current_slot = sd_bus_slot_ref(slot); r = node->leaf.callback->callback(bus, m, slot->userdata, &error_buffer); if (bus) - bus->current_slot = NULL; + bus->current_slot = sd_bus_slot_unref(slot); r = bus_maybe_reply_error(m, r, &error_buffer); if (r != 0) |