summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-04-29 11:18:53 +0200
committerLennart Poettering <lennart@poettering.net>2016-04-29 16:27:49 +0200
commitb75102e5bf4cf249052d42be955d403e3e03b47c (patch)
tree12f76a6591a5ac4c6e8ea63504a34b9b8ac7ee4f /src
parente4f673174e54f1f187ec78f5ac908a62fbeb1236 (diff)
core: rerun GC logic for a unit that loses a reference
Let's make sure when we drop a reference to a unit, that we run the GC queue on it again. This (together with the previous commit) should deal with the GC issues pointed out in: https://github.com/systemd/systemd/pull/2993#issuecomment-215331189
Diffstat (limited to 'src')
-rw-r--r--src/core/unit.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/unit.c b/src/core/unit.c
index 6c0684225a..81cd7ee2b8 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -3222,6 +3222,10 @@ void unit_ref_unset(UnitRef *ref) {
if (!ref->unit)
return;
+ /* We are about to drop a reference to the unit, make sure the garbage collection has a look at it as it might
+ * be unreferenced now. */
+ unit_add_to_gc_queue(ref->unit);
+
LIST_REMOVE(refs, ref->unit->refs, ref);
ref->unit = NULL;
}