Sorry if this question seems a bit noobish, I'm not exactly experienced in 
fltk, but I just realized something. You build a window with all these widgets 
on it doing var=new this and o=new that... but where are all those resources 
freed?

What happened to me is that I made a class called Form, which I use as a 
declared variable in main() (i.e.: no dynamic allocation for it). It contains a 
window MainWindow and all the window's widgets (made the class with fluid), so 
the class constructor builds everything using calls to new. I also made a 
destructor for the class, because I dynamically create some strings, so I 
figured they need to be freed in the destructor. Today, while I was debugging 
some stuff, I noticed that the destructor Form::~Form() never gets called when 
I close the application, which I do by calling exit(1) at some specific places. 
I figured that calling exit() means exiting immediately at that point, and 
screw everything else.

I did some research and found that calling the hide() method for a window 
closes the application for you, if it's the top one. So I changed my calls from 
exit() to MainWindow->hide(). Lo and behold, the destructor for my class now 
gets called, with a beautiful stack crash afterwards, which happens after the 
destructor is done.

I've looked at the documentation, searched this webpage and this forum, and I'm 
out of ideas. Can anyone clarify for me when and how the fltk resources get 
freed? If they don't, why??
I'd gdb it, but my head would probably explode (bit sick huge headache lol)

Cheers,
Dev
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to