E
Erwan Loisant
Hello.
I can't properly add elements to a GArray. Basically I have a GArray
of GList, so here is what I do to append an element in a given GList
of my GArray:
1. GList* currentBucket = g_array_index (buckets, GList*, index);
2. currentBucket = g_list_append(currentBucket, node);
3. g_array_insert_val(buckets, index, currentBucket);
1) Get the GList* at the "index" position
2) Append the "node" element in my GList
3) Put back the pointer to GList in the GArray (I think it is needed
especially for the first insertion, since currentBucket is NULL).
The problem is, each time I try to insert a new element, the
"currentBucket" that I get is NULL. For the first insertion at a given
level it's ok, but after that I am supposed to receive a non-null
GList.
Can you see what is the problem?
I can't properly add elements to a GArray. Basically I have a GArray
of GList, so here is what I do to append an element in a given GList
of my GArray:
1. GList* currentBucket = g_array_index (buckets, GList*, index);
2. currentBucket = g_list_append(currentBucket, node);
3. g_array_insert_val(buckets, index, currentBucket);
1) Get the GList* at the "index" position
2) Append the "node" element in my GList
3) Put back the pointer to GList in the GArray (I think it is needed
especially for the first insertion, since currentBucket is NULL).
The problem is, each time I try to insert a new element, the
"currentBucket" that I get is NULL. For the first insertion at a given
level it's ok, but after that I am supposed to receive a non-null
GList.
Can you see what is the problem?