[Mono-dev] Interop Callback Segmentation fault

Ivan N. Zlatev contact at i-nz.net
Tue Jul 11 08:25:05 EDT 2006


Hey,

I am on mono svn head and I get a segmentation fault when trying to
use this code:

===========================================
typedef void (*xine_event_listener_cb_t) (void *user_data,
                                          const xine_event_t *event);

void xine_event_create_listener_thread (xine_event_queue_t *queue,
                                        xine_event_listener_cb_t callback,
                                        void *user_data);

===========================================

                [DllImport ("libxine")]
                private static extern void
xine_event_create_listener_thread (IntPtr eventQueue, XineEventHandler
eventHandler, IntPtr data);

                public delegate void XineEventHandler (IntPtr data,
IntPtr eventArgs);
                ...
                        eventQueue = xine_event_new_queue (_stream);
                        if (_eventQueue != IntPtr.Zero) {
                                xine_event_create_listener_thread
(_eventQueue, HandleEvent, IntPtr.Zero);
                        }
                ...

                private void HandleEvent (IntPtr data, IntPtr eventArgs)
                {
                        Console.WriteLine ("Helllooo");
                }
===========================================

This works when HandleEvent is static but else segfaults:

(gdb) bt

#0  0x08790f66 in ?? ()
#1  0xb4c72a8a in listener_loop (queue_gen=0x878d670) at events.c:209
#2  0xb7eda34b in start_thread () from /lib/libpthread.so.0
#3  0xb7e4465e in clone () from /lib/libc.so.6

(gdb) p mono_pmip (0x08790f66)

Program received signal SIGSEGV, Segmentation fault.
0x0809603c in mono_jit_info_table_find (domain=0x0, addr=0x8790f66
"\022") at domain.c:173
173             MonoJitInfoTable *table = domain->jit_info_table;


Any ideas what am I doing wrong or if it is a mono bug?

-- 
Ivan N. Zlatev

Web: http://www.i-nZ.net
GPG Key: http://files.i-nZ.net/i-nZ.asc
"It's all some kind of whacked out conspiracy."



More information about the Mono-devel-list mailing list