GTree question



Hi all,

I'm using a GTree to make a cache of indexed usernames and it's respectives
structures..
The problem is: I have a timeout event that will execute g_traverse_tree()
at this tree and remove the logins that expired.

But what I'm noticing is that when I kinda have:
  B
 / \
A   C
if I free B user, it will seg. fault for unknow reason for me..

Is that allowed and it's my mistake somewhere or this is now allowed, change
the tree when I'm traversing it?

I have something like this:
struct user {
  gchar *username;
  ...
};
and I insert them to the tree using g_tree_insert (tree, user->username, user);
This way I can remove the item and free it's name without having to traverse
the tree. (eg. when user logouts..)
So I have freed the key pointer I inserted and removed it..

Any suggestion?

[]'s
-- 
Marcelo R Leitner <mrl netbank com br>
ICQ #: 29966851



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