Re: segfault on return to gkt_main()



Hello,


> Message: 3
> Date: Thu, 9 May 2002 16:44:15 -0400
> From: brenden grace <grace flipt com>
> To: gtk-list gnome org
> Subject: segfault on return to gtk_main()
>
> I currently have a callback fuction called
> void
> on_butApply_clicked                    (GtkButton       *button,
>                                       gpointer         user_data)
>

I don't know if this is your main concern, but the general prototype of a
callback function is :
gboolean callback (GtkObject *object, gpointer data)
and not void callback (GtkButton *button, gpointer data)

>
> it loads a string and then
>
> gtk_entry_set_text(GTK_ENTRY(tmpEntryTo), addLine);
>

What is addLine :
- where is it declared ?
- how is it affected ?
- is this pointer passed through the call_back function ?

>
> then returning to the calling function where it segfaults (i believe
> the calling function is gtk_main -- i am a little new to gtk).

> this happens usually with stings of length greater than about 80 chars
> ... but sometimes of shorter strings. is there soemthing i should know
> about writing large strings to entry widgets or should i continue to
> assume that i have a memory error/leak somewhere before this code
> segment. (i am sure it is not dying during or before the above
> gtk_entry_set_text)
>

Looks like an wrong access to memory (eg. pointer without content, or pointing a
wrong zone...). In this case, the segfault is not so deterministic as you think.
Re-read your source code , and don't try to speculate on the memory bugged
code's behaviour.

A good tool to track unauthorized memory accesses is Electric-Fence (probably
installed with your distribution). This could d help you to locate which pointer
is involved in your crash.

Thierry BRICHLER




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