On lun, 2011-09-12 at 15:10 -0400, Craig wrote:
> I am shocked to see that after I iterate through the GList, I cannot
> iterate through the list again.

That's an easy one :-)


>       while(events)
>       {
>               /* [...] */
>               events = g_list_next(events);           
>       }

You are modifying the list in the loop until g_list_next() returns
NULL ...


>       /// this is where the list appears to be empty!!!!
>       events = g_list_first(events);

so you are now trying to iterate over an empty list (events == NULL).
You probably want a dedicated variable for the iteration, e.g.

GList *iter;

events = g_list_reverse (events);
for (iter = events; iter; iter = iter->next)
  /* do stuff */;

for (iter = events; iter; iter = iter->next)
  /* do other stuff */;


Regards,
Florian

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to