Re: [patch] fixes numerous glib faults and mistypes, also re-whitespaced



Now that we're on the same page..

I am pretty darn sure my glib/gtk builds are correct, I have scads of gtk/glib
programs compiled and running against them and several other people have mentioned
the segfaults as well.  In my own experience, everytime memory allocation functions
behave weirdly, I screwed up earlier.  In self defense of my previous error, I've
only been writing GTK apps for a few weeks and sometimes it's worse than pulling
teeth when you're looking for an answer in the documentation and mailing lists.
However I do have many years behind me in C so don't dismiss me entirely :)

That said, something is certainly wrong with the heap if these functions are
emitting warnings and further causing segfaults.  My recommendation to further this
is to link with efence (one example) and use the malloc env debug settings.  If
that doesn't yield results it's time to step through it bit by bit.

When running the below, depending on the heap structure, glib will print changing
values for N, sometimes very low and sometimes in the many millions.  Again, a
strong hint to heap corruption.  On one development station it segfaults gloriously
left and right, on another the simple removal of the g free() was sufficient for it
to run.  Do keep in mind that the libraries on each of them are exactly the same
and the binary will act in a certain way on station X regardless of which one it
was compiled on.

I'm liking the idea of 'manedit' so I may have time to look into it.

-d

learfox furry ao net wrote:

(Note this e-mail being forwarded to the GTK+ app devel list, anyone who
has any idea on what might cause this glib behavour please reply!)

Erf, goodness!  This is really awkward.

I have a hunch, what if instead, you reverted back to the original source
and instead just change all occurances of strdup() to gstrdup() (or
whatever its equiv is?)

For everyone else the source for this GTK+ app in question is at:

        ftp://fox.mit.edu/pub/xsw/manedit0.4.tgz

<--- Original message --->

<breakpoints set at all foreach functions>

(gdb) r
Starting program: /usr/src/manedit0.4/manedit/./manedit

Breakpoint 6, FileBrowserInit () at fb.c:358
358             g_list_foreach(glist, (GFunc)g_free, NULL);

(gdb) n

GLib-WARNING **: freeing previously freed (16 times) memory

359             g_list_free(glist);
(gdb) n
360             gtk_widget_show(w);
(gdb) c
Continuing.

<open file button pressed>

Program received signal SIGSEGV, Segmentation fault.
0x4036249b in chunk_free (ar_ptr=0x403faca0, p=0x81a84f0) at malloc.c:3142
3142    malloc.c: No such file or directory.
        in malloc.c

#0  0x4036249b in chunk_free (ar_ptr=0x403faca0, p=0x81a84f0) at malloc.c:3142
#1  0x40362323 in __libc_free (mem=0x81a84f8) at malloc.c:3054
#2  0x0806f17e in FileBrowserGetResponse (title=0x80c6b3e "Open Manual Page",
    ok_label=0x80c6b39 "Open", cancel_label=0x80c6abf "Cancel",
    path=0x8379bd8 "/tmp", type=0x822f3c8, total_types=3, path_rtn=0xbfffe918,
    path_total_rtns=0xbfffe91c, type_rtn=0xbfffe920) at fb.c:449
#3  0x08060fb2 in EditorManualOpenCB (widget=0x827b910, data=0x82845e0)
    at editorcb.c:727
#4  0x400ccc5a in gtk_marshal_NONE__NONE (object=0x827b910,
    func=0x8060f24 <EditorManualOpenCB>, func_data=0x82845e0, args=0xbfffea34)
    at gtkmarshal.c:312
#5  0x40101635 in gtk_handlers_run (handlers=0x824dfd0, signal=0xbfffe9e0,
    object=0x827b910, params=0xbfffea34, after=0) at gtksignal.c:1917


fb.c:358 commented out:

(gdb) r
Starting program: /usr/src/manedit0.4/manedit/./manedit

<open file button pressed>


GLib-WARNING **: freeing previously freed (16 times) memory


GLib-WARNING **: freeing previously freed (24 times) memory


GLib-WARNING **: freeing previously freed (16369152 times) memory


Program received signal SIGSEGV, Segmentation fault.
0x4036249b in chunk_free (ar_ptr=0x403faca0, p=0x839bb28) at malloc.c:3142
3142    malloc.c: No such file or directory.
        in malloc.c

As is evidenced, all is not well but we get past the first segfault simply by
commenting on the foreach free action.

--
..NOTICE fwd: fwd: fwd: type emails will be deleted automatically.
      "There is a natural aristocracy among men. The grounds of this are
      virtue and talents", Thomas Jefferson [1742-1826], 3rd US President







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