Xlib, thread and gnome



hi

i am developing an application with gtk and thread.

I've received some Xlib: unexpected async reply  errors and looking on
the web i've see that i must use this code:

int
main (int argc, char *argv[])
{
GtkWidget *window;

/* init threads */
g_thread_init(NULL);
gdk_threads_init();

/* init gtk */
gtk_init(&argc, &argv);

window = create_window();
gtk_widget_show(window);

gdk_threads_enter();
gtk_main();
gdk_threads_leave();

return 0;
}

i've tried to add this code at my application but when i try to
execute it i get a segmentation fault error...

this is the reports of gdb:

Starting program:
/home/programmi/nik_stresser/nik_stresser/bin/nik_stresser_gtk
[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 2739)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 2739)]
0x40037a12 in pthread_mutex_lock () from /lib/libpthread.so.0
(gdb) bt
#0  0x40037a12 in pthread_mutex_lock () from /lib/libpthread.so.0
#1  0x40731cc5 in g_mem_chunk_new () from /usr/lib/libglib-2.0.so.0
#2  0x4071e809 in g_hash_table_size () from /usr/lib/libglib-2.0.so.0
#3  0x4071de12 in g_hash_table_insert () from /usr/lib/libglib-2.0.so.0
#4  0x40719073 in g_quark_to_string () from /usr/lib/libglib-2.0.so.0
#5  0x40718ec8 in g_quark_from_static_string () from /usr/lib/libglib-2.0.so.0
#6  0x406f2b72 in g_type_init_with_debug_flags () from
/usr/lib/libgobject-2.0.so.0
#7  0x406f2d02 in g_type_init () from /usr/lib/libgobject-2.0.so.0
#8  0x405fb554 in gdk_pre_parse_libgtk_only () from /usr/lib/libgdk-x11-2.0.so.0
#9  0x4042f6e3 in gtk_disable_setlocale () from /usr/lib/libgtk-x11-2.0.so.0
#10 0x4042f928 in gtk_disable_setlocale () from /usr/lib/libgtk-x11-2.0.so.0
#11 0x4073805b in g_option_context_parse () from /usr/lib/libglib-2.0.so.0
#12 0x4042fbce in gtk_parse_args () from /usr/lib/libgtk-x11-2.0.so.0
#13 0x4042fc06 in gtk_init_check () from /usr/lib/libgtk-x11-2.0.so.0
#14 0x4042fc56 in gtk_init () from /usr/lib/libgtk-x11-2.0.so.0
#15 0x0804cf5a in main (argc=1, argv=0xbffffa84) at src/nik_stresser_gtk.c:336
(gdb)

can you help me please? where am i wrong? thanks nik



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