Re: [gtk-list] Re: GTK_ENTRY cast segfaults, I think
- From: Jeroen Benckhuijsen <jeroen benck demon nl>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: GTK_ENTRY cast segfaults, I think
- Date: Fri, 25 Feb 2000 16:47:24 +0100
Ron Martin wrote:
>
> > 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
>
> --
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
Maybe an other piece of advise: I don't know which debugger you're using
currently, but i can recommend ddd (Data Display Debugger). It has a
nice way to show the values of variabeles, structures, etc
Jeroen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]