Destroying widgets

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

 



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

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux