Re: Help casting void pointer to GtkWidget



Hi Jasper

You were right, the error was in the construction of the button.

Thanks for your help, I am good to go now!

-Patrick




On 07/19/2015 04:09 PM, Jasper St. Pierre wrote:
Well, you're passing something that isn't a GtkWidget to sig_con1. The
type of the pointer should not matter as long as it points to a
GtkWidget (some secret sauce under the hood is used to know whether
it's a valid pointer or not).

We would need to see what calls sig_con1 to debug further, but look there.

On Sun, Jul 19, 2015 at 12:15 PM, Patrick
<patrick spellingbeewinnars org> wrote:
Hi Everyone

I am doing something strange. I am mixing C GTK and COBOL. It's GnuCOBOL and
it compiles to intermediate C.

I can create widgets by creating pointers in COBOL and passing them to C GTK
functions and such but I can't seem to connect signals.

This code:

int sig_con1( GtkWidget * widget_id ) {
   g_signal_connect(G_OBJECT(widget_id),"clicked",
G_CALLBACK(handler1_to_handler2),NULL);
.....


compiles but when it runs I get :

(anak:18978): GLib-GObject-WARNING **: invalid unclassed pointer in cast to
'GObject'

(anak:18978): GLib-GObject-WARNING **: instance with invalid (NULL) class
pointer


COBOL is actually passing in a void pointer so widget_id is actually type
void. I can't seem to cast it to a pointer to a G_OBJECT. Changing the
functions prototype to void * widget_id did not help.

Could anyone give me a tip or two of how to cast ?

Thanks-Patrick






_______________________________________________
gtk-list mailing list
gtk-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-list





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