Re: Hi, Glade problem (another question)



Martin Craig wrote:

Anyway, on the subject of Glade, I'm using libglade to load my UI, but
I need each file my app uses to have its own copy of certain widgets.
I'm doing glade_xml_new for each file I load and creating the widgets
with glade_xml_get_widget. So when I close a file, I want to do something
like glade_xml_destroy, but there doesn't seem to be a function like that.
Am I leaking memory (I suspect so)? How do I free the memory associated
with a GladeXML object?

Thanks for any help,

Martin.


Use gtk_object_unref(). 
Example:

GladeXML *xml;
static GtkWidget *main_window;

xml = glade_xml_new("test.glade", "app1");
if (!xml) {
        g_warning("Could not load the interface");
        return 1;
}
main_window = glade_xml_get_widget(xml, "app1");
...
gtk_object_unref(GTK_OBJECT(xml));
...
gtk_main();



Regards,
--
Dean Schumacher                 Email: dean schumacher usa alcatel com
Software Engineering Tools      Phone: 972.519.3252
Alcatel USA




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