Re: segfault problem.



HaB JacKaL wrote:

I have checked and double checked all my declarations. I finally ran it through gdb, which reported the following error:

Program received signal SIGSEGV, Segmentation fault.
0x4015d8a8 in gtk_type_check_object_cast () at eval.c:41
41      eval.c: No such file or directory.
       in eval.c


eval.c is NOT one of my files. Here is the line that causes that error to appear from my code, along wth the var declaration:

gchar *tmp6;

tmp6 = gtk_editable_get_chars(GTK_EDITABLE(billto->address1), 0, -1);
 gtk_entry_set_text(GTK_ENTRY(shipto->address1), tmp6);
 g_free(tmp6);

there are 5 identical lines above that which work fine. The entry widget in question is set to a max size of 64 chars, but so is the target widget, and the data isn't anywhere near that long in the first place.


Hi HaB, it's hard to say without seeing your code, but it sounds like some sort of evil memory corruption thing. You're maybe free()ing something you shouldn't free, or writing to memory you shouldn't write to.

I'd try it with electric fence: relink you program, adding -lefence at the end. This replaces the usual malloc()/free() code with stuff to automatically check all memory references. You're program will run very slowly, but as soon as it puts a foot wrong, you'll get a segv. Run inside gdb (have you tried one of the gdb GUIs? I use ddd), and you should see the problem.

John




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