chiark / gitweb /
unit: don't allow units to be gc'ed that still are referenced via UnitRef
[elogind.git] / src / core / unit.c
index ba4c7d5b32838d1e4a671b345d6a2243f534a980..c9cd9ee2a0142b19d2e4d11e3ed6a2da28ae50a0 100644 (file)
@@ -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;