On 30.05.2012 16:55, Greg Ercolano wrote:
> On 05/29/12 19:26, David Currie wrote:
>> Consider the following,
>
>       When you receive control back from Fl::run(), your program
>       is supposed to exit.

No, not really, although most programs *will* exit then. The only
thing that can be said in this case is that FLTK has closed (hidden)
all windows when it returns from Fl::run().

>       When you hit ESC, fltk has already deleted the widgets.

That's not true. As said before, all windows have been closed by
calling hide() on them, but they have NOT been destroyed (by FLTK),
unless you did it explicitly in your code.

>       Doing the delete's outside the Fl::run() is redundant,
>       causing the undefined behavior; by that time, the pointers
>       are wild.

See above. If you take this as an example for creating and deleting
windows over and over again, then it is correct to delete the window
after it has been hidden. The code given seems to be correct, AFAICT.

In earlier versions of FLTK (1.1) it was important to use
Fl::delete_widget() instead of using delete directly, but this
shouldn't be necessary any more, especially not if the window has
already been closed and Fl::run() has exited.

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

Reply via email to