Le jeudi 23 mars 2006 à 16:05 +0100, hm a écrit : > I would like to write simple application in gtk. There is a button defined in main () function. I`m connecting a signal function, with an clicked-event as follows : > > gtk_signal_connect ( GTK_WIDGET ( ShitButton ), "clicked", GTK_SIGNAL_FUNC ( ReceivedLoad ), (gpointer)(Labelz) ); > > The last parameter is a type cast from GtkWidget * Labelz[10] to a gpointer. I need it, because I want a ReceivedLoad function, to create ten new labels. Here is a ReceivedLoad function : > > gint ReceivedLoad ( GtkWidget * w, gpointer * p, gpointer ** Labelz ) > { > GtkWidget ** cLabelz; > cLabelz = (GtkWidget**) Labelz; > int i,j=0; > for ( i = 0; i < 10; i ++ ) > { > > (...) > > *( cLabelz + i ) = gtk_label_new("X"); > > g_print("\n%ld, [%i]", (long int)(cLabelz), i ); > j = 0; > //gtk_widget_show ( Labelz[i] ); > > } > g_print("Returned to signal\n"); > > return 1; > } > > Everything is going right, but when the function is going to return from signal call, program crashes with Segmentation fault. When I exchange return with exit, everything goes right, so the problem is in RETURNING from function.. What`s wrong and how to make it correct ? > _______________________________________________ The signal prototype for "clicked" signal is void user_function( GtkWidget * widget , gpointer data ); not void user_function( GtkWidget *widget,gpointer * p , gpointer ** data ) ^^^^^^^^^^^^^ Try this code void ReceivedLoad( GtkWidget * w , GtkWidget ** labelz ) { (...) //return 1; } It works (I've tested it). Also gtk_signal_connect is obsolete with gtk+-2.0 use g_signal_connect instead (see gtk_signal.h) Regards Régis _______________________________________________ gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list