Re: problem deleting derived widgets ...



Ok I may have found a solution, I think that the problem lies in calling
the Base object's constructor in your derived object.  You have to call
it to ensure proper destruction of both base and son.  Surely it applies
to all relations of this type, meaning, not a GTKMM problem but my own
in programming. 

Thanks anyway, and sorry for the inconvenience

On Tue, 2008-08-26 at 16:50 -0430, teratux wrote:
> Hi ... I'm trying out an application that I want to create that uses a
> glade file to load some widgets.  I noticed that when I use several
> Dialogs in my application an I load'em all up when my app starts, my
> memory usage sort of rises a little.  I want to manage my own dialog
> creation and destruction rutines.  I tried doing a little example to see
> if there really is no memory leakage involved in this and stumbled upon
> a little problem.  
> 
> I tried with a basic widget ( no glade involved ):
> 
> Gtk::Dialog* dialog = 0;
> 
> while (1)
> {
> 	dialog = new Gtk::Dialog();
> 	delete dialog;	
> }
> 
> No problem here ....
> Tried using a widget loaded from a glade file:
> 
> Glib::RefPtr<Gnome::Glade::Xml> refXml;
> Gtk::Dialog* dialog = 0;
> 
> while (1)
> {
> 	refXml = Gnome::Glade::Xml::create("glade.glade", "dialog1");
> 	refXml->get_widget( "dialog1", dialog );
> 	delete dialog;	
> }
> 
> No problem here ...
> But, when I use a derived widget ...
> 
> Glib::RefPtr<Gnome::Glade::Xml> refXml;
> MyDialog* dialog = 0;
> 
> while (1)
> {
> 	refXml = Gnome::Glade::Xml::create("glade.glade", "dialog1");
> 	refXml->get_widget_derived( "dialog1", dialog );
> 	delete dialog;	
> }
> 
> Leakage all around ... I tried consulting the gtkmm documentation and
> there's no say about memory management for derived widgets.  Even the
> example with libglademm calls it's empty destructor like I do.
> 
> Can anyone help me??
> Thanks ...
> 



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