Re: GTK_ENTRY cast segfaults, I think



> Segfault means your accessing memory you're not permitted to access.
> Your problem is probably that the pointer stored in entry_temp is not
> the pointer you want (the pointer to the entry-data). It will probably
> just contain nonsense. Solution: check you're code where the pointer is
> assigned, write it down, and compare it with the pointer you retrieve.
> If they differ, you did something wrong, what is hard to say without the
> code...

This was an excellent idea.  The pointers definatly do NOT reference the
same address space.  I have decided to take a different approach,
however.  Instead of storing the entry widgets in a list, I will just
attach each entry widget individually, allowing me to reference them in
the callback funtion rather than having to travers the linked list.  It
would be easier for me to implement (easier == cleaner code IMHO).

> Also i think this code is very weird. You alloc memory for a
> info_database and store
> it in an other type of structure....
> 
>         input_info = (struct conn_info *)malloc(sizeof(info_database));
>         bzero(input_info, sizeof(info_database));
> 
> Also you may want to add a check wheter the allocation was succesful
> (input_info != NULL) or you'll get a segfault when the allocation fails.
> Using g_malloc() solves this problem, but it exists you're app when it
> fails, depends on you're choices..
> 

Fine points.  I honestly didn't realize I had that in there.  It was
there when I first thought about the callback funtion, and somehow
missed my deleting frenzy I had.  Ah well.
> Jeroen
> 
> --
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null

Thanks again for replying so quickly!

Ron Martin
rmartin@cps.cmich.edu



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