Re: Problems with g++ and gtk_widget_destroy() to destroy windows?!?!?!



On Tue, 2003-05-06 at 21:18, David Topper wrote:
> Well, I've already been burned by the finer points of casting and 
> GtkItemFactoryEntry callbacks.  So I'm wondering if something similar is 
> going on here.  I use the following technique all over my code:
> 
> gtk_signal_connect_object(GTK_OBJECT(cancel_button), "clicked",
>                               GTK_SIGNAL_FUNC(gtk_widget_destroy),
>                               GTK_OBJECT(some_win));
> 
> but in a new section (written in C++) I get errors when I click the 
> "cancel" button:
> 
> Gtk-CRITICAL **: file gtkwidget.c: line 1388 (gtk_widget_destroy): 
> assertion `GTK_IS_WIDGET (widget)' failed.
> 
> So should I move the relevant sections of the code into a .c file?  Or 
> is there a better workaround?

I don't think it has anything to do with C vs. C++. You simply have
a bug somewhere.

The two main things you have to worry about when using straight GTK+
from C++, are:

 A) You can't use non-static member functions as callbacks.
 B) Extra casts will be needed in some places; E.g., in
    gtk_table_attach(), you need to do 
    
    (GtkAttachOptions) GTK_EXPAND | GTK_FILL

Regards,
                                        Owen





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