mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2026-05-04 21:08:10 +02:00
bigfix: fix a problem with egg_obj_list_clear where the last item was not being removed from the list
This commit is contained in:
parent
67c7fb3cda
commit
e5de05c69a
1 changed files with 5 additions and 8 deletions
|
|
@ -137,8 +137,6 @@ egg_obj_list_set_from_string (EggObjList *list, EggObjListFromStringFunc func)
|
|||
void
|
||||
egg_obj_list_clear (EggObjList *list)
|
||||
{
|
||||
guint i;
|
||||
gpointer obj;
|
||||
GPtrArray *array;
|
||||
EggObjListFreeFunc func_free;
|
||||
|
||||
|
|
@ -146,12 +144,11 @@ egg_obj_list_clear (EggObjList *list)
|
|||
|
||||
array = list->priv->array;
|
||||
func_free = list->priv->func_free;
|
||||
for (i=0; i<array->len; i++) {
|
||||
obj = g_ptr_array_index (array, i);
|
||||
if (func_free != NULL)
|
||||
func_free (obj);
|
||||
g_ptr_array_remove (array, obj);
|
||||
}
|
||||
|
||||
if (func_free != NULL)
|
||||
g_ptr_array_foreach (array, (GFunc) func_free, NULL);
|
||||
g_ptr_array_remove_range (array, 0, array->len);
|
||||
|
||||
list->len = 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue