glib gsource segfault



Hi,
I'm having some trouble with glib-2.6.0 which segfaults on me once some GIOChannels in the main event loop are used. The error occurs in g_source_callback_ref where the argument cb_data suddently becomes 0x1 instead of something meaningful.

Heres a gdb rundown:

Breakpoint 3, 0x55057b7a in IA__g_io_add_watch_full (channel=0x91f87a0, priority=153065536, condition=27, func=0x55022568 <handle_in>,

   user_data=0x55026851, notify=0) at giochannel.c:479

This is fine - the source is registered to the main event loop with callback function "handle_in" at 0x55022568 and user_data pointing to another function.
--

Breakpoint 2, g_source_callback_ref (cb_data=0x91f87b8) at gmain.c:1179

1179    {

This happens once the very first chunk of data arrives on the channel and all is still fine.
--

x/4x 0x91f87b8

0x91f87b8:      0x00000001      0x55022568      0x55026851      0x00000000

The _GSourceCallback structure at 0x91f87b8 has these 4 members (guint ref_count, GSourceFunc func, gpointer data, GDestroyNotify notify). This looks fine - a refence count of 1, pointer to "handle_in", pointer to another function and no notify function.
--

Breakpoint 2, g_source_callback_ref (cb_data=0x1) at gmain.c:1179

1179    {

Then this happens once the SECOND chunk of data arrives on the channel. cb_data is know 0x1 and the program segfaults since g_source_callback_ref is trying to alter memory at that address!


After going through my code countless of times I'm still at a loss as to what is going on. I'm not removing or altering GSources in any way during this. Does anybody have a hint as to what might be my problem?

/Jonas



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