Hello, I'm receiving an undefined behaviour in a GtkFileSelection using gtk 2.2.1. Sometimes it works, most times I'm getting segfaults like this: --- Program received signal SIGSEGV, Segmentation fault. 0x2820d7f1 in gtk_tree_view_get_type () from /usr/X11R6/lib/libgtk-x11-2.0.so.200 --- Program received signal SIGSEGV, Segmentation fault. 0x2851d4ea in pango_item_free () from /usr/X11R6/lib/libpango-1.0.so.200 --- Program received signal SIGSEGV, Segmentation fault. 0x28226ac3 in gtk_widget_unrealize () from /usr/X11R6/lib/libgtk-x11-2.0.so.200 The necessary code: void _lpref_add_lesson_file (GtkWidget* widget, gpointer data) { /* opens the default gtk-2 file selection dialogue */ GtkWidget* file_select; file_select = gtk_file_selection_new ("Add Lesson file"); g_signal_connect (G_OBJECT (GTK_FILE_SELECTION (file_select)->ok_button), "clicked", G_CALLBACK(_lpref_add_lesson), file_select); g_signal_connect_swapped (G_OBJECT (GTK_FILE_SELECTION (file_select)->ok_button), "clicked", G_CALLBACK (gtk_widget_destroy), file_select); g_signal_connect_swapped (G_OBJECT (GTK_FILE_SELECTION (file_select)->cancel_button), "clicked", G_CALLBACK (gtk_widget_destroy), file_select); gtk_widget_show (file_select); return; } void _lpref_add_lesson (GtkWidget *widget, GtkFileSelection* select) { /* call the internal function with the selected file */ data_add_lesson_file ((char *) gtk_file_selection_get_filename (GTK_FILE_SELECTION (select))); return; } Using a gtk_widget_destroy (GTK_WIDGET (select)); in _lpref_add_lesson and removing the g_signal_connect_swapped from the ok_button results in the same behaviour. Any idea, where I'm worng with my code? Regards Marcus --- Mr. Cole's Axiom: The sum of the intelligence on the planet is a constant; the population is growing.
Attachment:
pgp0Di8JChVii.pgp
Description: PGP signature