g_thread_init causes hangs
- From: Ola Andersson <rand ling umu se>
- To: gtk-list redhat com
- Subject: g_thread_init causes hangs
- Date: Fri, 15 Oct 1999 11:31:15 +0200
Hi!
I tried to make a GTK program with pthreads and when trying
to close the program by closing the window it hangs.
I removed all thread code and it still hangs because
of the g_thread_init call.
See code below. Somehow the gtk_object_set_data_full() row
is causing the problem, if I comment it the program works fine.
I'm using gtk 1.2.5.
Here's the full program: (linked with: -lpthread -lgthread -lgtk -lgdk
-lX11 -lglib)
#include <gtk/gtk.h>
gboolean delete_event_cb(GtkWidget *widget,GdkEvent *event,gpointer
user_data)
{
gtk_main_quit();
return FALSE;
}
int main(int argc,char **argv)
{
GtkWidget *window,*vbox;
g_thread_init(NULL);
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
vbox = gtk_vbox_new(FALSE, 0);
gtk_widget_ref(vbox);
gtk_object_set_data_full(GTK_OBJECT(window),"vbox",
vbox,(GtkDestroyNotify)gtk_widget_unref);
gtk_widget_show(vbox);
gtk_container_add(GTK_CONTAINER(window),vbox);
gtk_signal_connect(GTK_OBJECT(window),"delete_event",
GTK_SIGNAL_FUNC(delete_event_cb),NULL);
gtk_widget_show(window);
gtk_main();
return 0;
}
--
Ola Andersson mailto:rand@ling.umu.se
Research Engineer http://www.ling.umu.se/~rand
Department of Phonetics Phone: +46 90 786 56 81
Umea University Fax: +46 90 786 63 77
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]