Re: GList empty after iteration?



On 09/12/2011 11:33 PM, Craig wrote:
On Mon, 2011-09-12 at 22:20 +0200, Florian MÃllner wrote:
You are modifying the list in the loop until g_list_next() returns
NULL ... 

Right.  I understand this now.  However, I thought using g_list_first()
would set GList *events back to the first object.  But, as you state,
the darn thing is pointing to NULL, so getting the first object of NULL
is problematic.

Thanks for helping me hack through this.  I have created a solution.



if you want such a data structure use a GQueue. The data inside the
GQueue is still a list, but the GQueue manages the pointers to the tail
and the head for you (so append() and prepend() have equal speed as well).

Olivier




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]