Destroying widgets
- From: Lindley M French <lfrench1 gmu edu>
- To: gtk-list gnome org
- Subject: Destroying widgets
- Date: Thu, 14 Feb 2008 11:17:20 -0500
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.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]