RE: resizing tables with widget and unref



Hi folks,

> Use gtk_container_remove() for this. Also, gtk_object_destroy() will
> automatically remove the widget from its container.

I'm having some problems with this too! I've got a sub window from my main
on which has a global clist in it. When this window is destroyed I want
everything destroyed apart from the clist itself, I think it does that, but
when I try and reopen my window I get this error:

Gtk-CRITICAL **: file gtkcontainer.c: line 715 (gtk_container_add):
assertion `widget->parent == NULL' failed.

So I presume it isn't being removed from its container - if I comment out
the line which adds the clist into the window this error does not happen!

What is so obvious but I am missing it anyway?

Rich

PS - I've tried a hundred different things on this bit of code, so it is no
wonder it currently seg faults during the callback....

***

static GtkWidget *remove_list; // global

static void remove_list_from_panel(GtkWidget *widget, GtkWidget *main_vbox)
{
  gtk_widget_ref(remove_list);
  gtk_container_remove(GTK_CONTAINER(main_vbox), remove_list);
  remove_list->parent=NULL;
  gtk_widget_unref(remove_list);
  gtk_widget_destroy(widget);
  gtk_object_destroy(GTK_OBJECT(remove_list));
}

static void remove_panel()
{
  GtkWidget *remove_panel_window=NULL;
  GtkWidget *main_vbox=NULL, *scrolled=NULL;
 
  remove_panel_window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_signal_connect(GTK_OBJECT(remove_panel_window), "destroy",
GTK_SIGNAL_FUNC(remove_list_from_panel), &main_vbox);




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