gpointer help needed



Hello all,

        I'm having a bit of trouble passing a data structure to a callback. 
I'm trying to pass a structure as a data member, but the compile fails when I
try to use the structure in the callback.  Could someone point out my (probably
very obvious) mistake?  Here is what I have:

/* file.h */

struct _my_structure {
        ...
};

void destroy_object (GtkWidget *widget, gpointer data);


/* file.c */
int
main( ... ){

        ...
        struct _my_structure dataA;
        ...

        gtk_signal_connect (GTK_OBJECT (window), "delete_event",
                            GTK_SIGNAL_FUNC (destroy_object), (gpointer)&data);

        ...
}

void 
destroy_object (GtkWidget *widget, gpointer data)
{
        ...
        /* This fails to compile */
        (struct _my_structure *)data->member;
}


Thanks,
Scott



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