From 9d576438a1ee932bde1fb0f1be1aa5cae646fd4e Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 10 Sep 2012 10:12:10 +0200 Subject: unit: don't allow units to be gc'ed that still are referenced via UnitRef --- src/core/unit.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/core/unit.c b/src/core/unit.c index ba4c7d5b32..c9cd9ee2a0 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -258,6 +258,9 @@ bool unit_check_gc(Unit *u) { if (unit_active_state(u) != UNIT_INACTIVE) return true; + if (u->refs) + return true; + if (UNIT_VTABLE(u)->check_gc) if (UNIT_VTABLE(u)->check_gc(u)) return true; -- cgit v1.2.3-54-g00ecf