> My app consists of one window which calls other class/windows to create popup 
> windows.
> The popup windows are created and deleted everytime they are called to reduce 
> amount of memory usage.
> There is no way to have multiple popup windows and they are all modal.
> The main window is never deleted so I guess the popup's parent is never 0 (?)
> The popup window's callback is always called, then the class destructor calls 
> delete_widget(window).
> I do not understand what difference would it make where delete_widget is 
> called as the sequence  is the same (?) when class/window closes.
> I moved the delete_widget(window) to window's callback and no diference was 
> noticed.
>


Well, that's a problem.  When you delete a child window, its
parent doesn't know that it's gone.  Eventually the parent's
destructor is going to try to delete what you've already
deleted.  Since your main window is never deleted, you don't
notice anything, but what you are seeing is the memory for the
parent's array of child widgets continuing to grow as you create
children.

Try this in the callback
  if(w->parent()) w->parent()->remove(*w);
  Fl::delete_widget(w);


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

Reply via email to