If anyone is having similar issues, I found the reason gtk_widget_destroy appeared to be corrupting memory. I had a destroy handler attached to another widget further down the hierarchy, and *that* handler called delete on the same object I was trying to get rid of in the first place. Except it didn't call the same destructor---I would have noticed that with my breakpoints---due to a mis-cast on the pointer. Lesson learned: gtk cleanup should be triggered from class destruction, *not* the other way around. And certainly not both ways around at once. ----- Original Message ----- From: Lindley M French <lfrench1@xxxxxxx> Date: Thursday, February 14, 2008 11:17 am Subject: Destroying widgets > Let's say I've got a hierarchy of widgets inside a C++ class. > There's a vbox which is the top of the hierarchy, and it may or may > not be attached to a parent; it's the handle by which users of the > class connect the internal GTK hierarchy to whatever they've got. > > I want to be able to cleanly destroy this portion of the hierarchy > at will. At present, I'm simply doing: > > gtk_object_destroy(GTK_OBJECT(vbox)); > > in the class's destructor. > > However, this appears to corrupt other memory in the class > inexplicably. The next internal object to be freed is fine until > gtk_object_destroy() is called; then it becomes garbage. Since this > object is unrelated to Gtk, I suppose I must be doing something wrong. > > First, is destroying the top of a hierarchy enough to destroy the > entire thing? Second, will any containers currently holding this > vbox as a child remove it properly when it's destroyed? Lastly, why > might gtk_object_destroy corrupt unrelated memory? > > I've learned from my previous mistake----the destructor will only > be called from a g_idle_add'd function. > _______________________________________________ > gtk-list mailing list > gtk-list@xxxxxxxxx > http://mail.gnome.org/mailman/listinfo/gtk-list > _______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list