mirror of
https://github.com/AuxXxilium/eudev.git
synced 2025-03-09 15:14:01 +07:00
unit: when destructing units make sure we don't readd the unit to the gc queue after we already removed it there
This commit is contained in:
parent
27ca8d7a25
commit
964e0949dd
@ -543,13 +543,24 @@ static void manager_clear_jobs_and_units(Manager *m) {
|
|||||||
|
|
||||||
assert(m);
|
assert(m);
|
||||||
|
|
||||||
manager_dispatch_cleanup_queue(m);
|
|
||||||
|
|
||||||
while ((j = hashmap_first(m->transaction_jobs)))
|
while ((j = hashmap_first(m->transaction_jobs)))
|
||||||
job_free(j);
|
job_free(j);
|
||||||
|
|
||||||
while ((u = hashmap_first(m->units)))
|
while ((u = hashmap_first(m->units)))
|
||||||
unit_free(u);
|
unit_free(u);
|
||||||
|
|
||||||
|
manager_dispatch_cleanup_queue(m);
|
||||||
|
|
||||||
|
assert(!m->load_queue);
|
||||||
|
assert(!m->run_queue);
|
||||||
|
assert(!m->dbus_unit_queue);
|
||||||
|
assert(!m->dbus_job_queue);
|
||||||
|
assert(!m->cleanup_queue);
|
||||||
|
assert(!m->gc_queue);
|
||||||
|
|
||||||
|
assert(hashmap_isempty(m->transaction_jobs));
|
||||||
|
assert(hashmap_isempty(m->jobs));
|
||||||
|
assert(hashmap_isempty(m->units));
|
||||||
}
|
}
|
||||||
|
|
||||||
void manager_free(Manager *m) {
|
void manager_free(Manager *m) {
|
||||||
|
14
src/unit.c
14
src/unit.c
@ -323,10 +323,15 @@ void unit_free(Unit *u) {
|
|||||||
if (UNIT_VTABLE(u)->done)
|
if (UNIT_VTABLE(u)->done)
|
||||||
UNIT_VTABLE(u)->done(u);
|
UNIT_VTABLE(u)->done(u);
|
||||||
|
|
||||||
/* Detach from next 'bigger' objects */
|
|
||||||
SET_FOREACH(t, u->meta.names, i)
|
SET_FOREACH(t, u->meta.names, i)
|
||||||
hashmap_remove_value(u->meta.manager->units, t, u);
|
hashmap_remove_value(u->meta.manager->units, t, u);
|
||||||
|
|
||||||
|
if (u->meta.job)
|
||||||
|
job_free(u->meta.job);
|
||||||
|
|
||||||
|
for (d = 0; d < _UNIT_DEPENDENCY_MAX; d++)
|
||||||
|
bidi_set_free(u, u->meta.dependencies[d]);
|
||||||
|
|
||||||
if (u->meta.type != _UNIT_TYPE_INVALID)
|
if (u->meta.type != _UNIT_TYPE_INVALID)
|
||||||
LIST_REMOVE(Meta, units_per_type, u->meta.manager->units_per_type[u->meta.type], &u->meta);
|
LIST_REMOVE(Meta, units_per_type, u->meta.manager->units_per_type[u->meta.type], &u->meta);
|
||||||
|
|
||||||
@ -344,15 +349,8 @@ void unit_free(Unit *u) {
|
|||||||
u->meta.manager->n_in_gc_queue--;
|
u->meta.manager->n_in_gc_queue--;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free data and next 'smaller' objects */
|
|
||||||
if (u->meta.job)
|
|
||||||
job_free(u->meta.job);
|
|
||||||
|
|
||||||
cgroup_bonding_free_list(u->meta.cgroup_bondings);
|
cgroup_bonding_free_list(u->meta.cgroup_bondings);
|
||||||
|
|
||||||
for (d = 0; d < _UNIT_DEPENDENCY_MAX; d++)
|
|
||||||
bidi_set_free(u, u->meta.dependencies[d]);
|
|
||||||
|
|
||||||
free(u->meta.description);
|
free(u->meta.description);
|
||||||
free(u->meta.fragment_path);
|
free(u->meta.fragment_path);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user