[gtk-list] Proper way to destroy widgets?



I was wondering if there was any functions we should call before
destroying particular widgets.  I'm making an app with a flexible-ish
dialog class (coded in GTK--).  The class is derived from Gtk_Dialog, and
when it is initialized, it creates a new label and slaps that in the vbox,
then you can add buttons which it slaps into the action_area.  Here's some
pseudo-code to clarify:
 class gcDialog : Gtk_Dialog {
   gcDialog(char *label_txt) {
     Gtk_Label *label = new Gtk_Label(label_txt);
     vbox().pack_start(label, ...);
   }
   add_button(char *label_txt, FuncPtr *func) {
     Gtk_Button *button = new Gtk_Button();
     action_area().pack_start(button, ...);
   }
 };

Do I need to preserve copies of the child widgets (the labels and buttons)
in order to free them when the dialog is destroyed?  What other functions
should I call to get the dialog window off the screen?  Currently I have
my button callbacks call dialog->hide() and dialog->destroy(), but for
some reason it gives me the following errors when a button is pressed:

** WARNING **: invalid cast from (NULL) pointer to `GtkObject'

** WARNING **: file gtkobject.c: line 1092 (gtk_object_get_data_by_id):
"object != NULL"

** WARNING **: file gtkbutton.c: line 856 (gtk_button_add): "GTK_IS_BUTTON
(container)"

and the next time I open a dialog, it gives me a blank window.

Thanks
---
Matt Perry [guy@mikepery.linuxos.org]

If you think things can't get worse it's probably only because you
lack sufficient imagination.
---



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