daemon: use a different GList pointer to iterate the components list

This keeps the original head pointer intact, so that we can effectively
free the list later. If we use the head pointer to iterate, then at the
end we are not freeing anything because the pointer is NULL
This commit is contained in:
George Kiagiadakis 2023-04-11 22:19:50 +03:00 committed by Julian Bouzas
parent e55e8bb447
commit 7ed188fba3

View file

@ -86,6 +86,7 @@ struct _WpInitTransition
WpTransition parent;
WpObjectManager *om;
GList *components;
GList *components_iter;
ComponentData *curr_component;
};
@ -164,11 +165,11 @@ load_enable_components (WpInitTransition *self)
{
WpCore *core = wp_transition_get_source_object (WP_TRANSITION (self));
while (self->components) {
self->curr_component = (ComponentData *) self->components->data;
while (self->components_iter) {
self->curr_component = (ComponentData *) self->components_iter->data;
/* Advance */
self->components = g_list_next (self->components);
self->components_iter = g_list_next (self->components_iter);
/* Skip component if its dependencies are not met */
if (!component_meets_dependencies (core, self->curr_component)) {
@ -415,6 +416,7 @@ wp_init_transition_execute_step (WpTransition * transition, guint step)
if (json_comps)
append_json_components (&self->components, json_comps);
self->components_iter = g_list_first (self->components);
wp_transition_advance (transition);
break;
}