]> err.no Git - systemd/commitdiff
unit: avoid assert on daemon reload
authorLennart Poettering <lennart@poettering.net>
Fri, 4 Jun 2010 20:31:33 +0000 (22:31 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 4 Jun 2010 20:31:33 +0000 (22:31 +0200)
src/manager.c
src/unit.c

index 735a1aaa4de9a5716b3db279984e87d1e7b65f6f..e37aa836027ddb3da7da60a137b340daf21b091a 100644 (file)
@@ -543,6 +543,8 @@ static void manager_clear_jobs_and_units(Manager *m) {
 
         assert(m);
 
+        manager_dispatch_cleanup_queue(m);
+
         while ((j = hashmap_first(m->transaction_jobs)))
                 job_free(j);
 
@@ -555,7 +557,6 @@ void manager_free(Manager *m) {
 
         assert(m);
 
-        manager_dispatch_cleanup_queue(m);
         manager_clear_jobs_and_units(m);
 
         for (c = 0; c < _UNIT_TYPE_MAX; c++)
index c08091942e4728fc5561cccf4216f50a3aadfb40..695044a77f33e9a5e54069bac3fdee518c6cf6a8 100644 (file)
@@ -319,6 +319,10 @@ void unit_free(Unit *u) {
 
         bus_unit_send_removed_signal(u);
 
+        if (u->meta.load_state != UNIT_STUB)
+                if (UNIT_VTABLE(u)->done)
+                        UNIT_VTABLE(u)->done(u);
+
         /* Detach from next 'bigger' objects */
         SET_FOREACH(t, u->meta.names, i)
                 hashmap_remove_value(u->meta.manager->units, t, u);
@@ -344,10 +348,6 @@ void unit_free(Unit *u) {
         if (u->meta.job)
                 job_free(u->meta.job);
 
-        if (u->meta.load_state != UNIT_STUB)
-                if (UNIT_VTABLE(u)->done)
-                        UNIT_VTABLE(u)->done(u);
-
         cgroup_bonding_free_list(u->meta.cgroup_bondings);
 
         for (d = 0; d < _UNIT_DEPENDENCY_MAX; d++)