How to work with a gpointer argument



I have a callback function which looks like:

void rip( GtkWidget *widget, GdkEvent *event, gpointer
source_combo_box )
{
    gtk_combo_box_append_text( source_combo_box, "HHH");
}

And causes a segmentation fault whenever it is called. Why is this? I
thought perhaps I need to cast the source_combo_box but can't find a way
that helps. The source_combo_box is a GtkComboBox being assigned in the
following way:

GtkWidget *make_source_box( GtkWidget *source_combo_box, GtkWidget
*rip_button )
{
    GtkWidget *box;
    ...
    g_signal_connect( rip_button, "clicked", G_CALLBACK( rip ),
source_combo_box);

    gtk_container_add( GTK_CONTAINER( box ), source_combo_box );
    ...
    return box;
}

Which, finally, is in turn called by
gtk_container_add( GTK_CONTAINER( window ), 
                        make_source_box( source_combo_box,
rip_button ) );

Any help much appreciated, let me know if any more details are required.

Regards.




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