From: Christian Dywan Date: Fri, 22 May 2009 00:40:02 +0000 (+0200) Subject: Ensure we remove all items in katze_array_clear X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=551843da1dd641dd600a8f66b6262542c4ab9412;p=midori Ensure we remove all items in katze_array_clear Apparently looping through 'all' items isn't sufficient, so now we remove the very first item until the list is empty. --- diff --git a/katze/katze-array.c b/katze/katze-array.c index b9ff9647..5df9291f 100644 --- a/katze/katze-array.c +++ b/katze/katze-array.c @@ -111,16 +111,10 @@ _katze_array_move_item (KatzeArray* array, static void _katze_array_clear (KatzeArray* array) { - guint n; - guint i; GObject* item; - n = g_list_length (array->items); - for (i = 0; i < n; i++) - { - if ((item = g_list_nth_data (array->items, i))) - katze_array_remove_item (array, item); - } + while ((item = g_list_nth_data (array->items, 0))) + katze_array_remove_item (array, item); g_list_free (array->items); array->items = NULL; }