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
This commit is contained in:
parent
e4f673174e
commit
b75102e5bf
|
@ -3222,6 +3222,10 @@ void unit_ref_unset(UnitRef *ref) {
|
||||||
if (!ref->unit)
|
if (!ref->unit)
|
||||||
return;
|
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);
|
LIST_REMOVE(refs, ref->unit->refs, ref);
|
||||||
ref->unit = NULL;
|
ref->unit = NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue