Gtk signal_connect problem



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 ?



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