> Fabien Costantini wrote: ./.. > > This is exactly why mike suggested to implement release() in the Fl_Image > > class I think. > > He wrote "refcounting", but I don't want to be nitpicking, maybe > that's what he meant. > > > This way, we could avoid completely the need of deleting images. > > No, objects are created with new, and objects are deleted with > delete (or variants). Static and local objects are deleted > automatically, you can't do anything against that. Adding > release() to Fl_Image as an alternate means of destroying > an Fl_*_Image object might work, but still calling delete > explicitly would do the wrong thing for Fl_Shared_Images. No, objects simply behave as you program them, and you can document and force user to do what you recommend :-) That said, even if : The static variable can be allocated by using a pointer and a new affectation too like Fl_Image *staticImage = new Fl_Shared_Image(...) . We should not even worry about their destruction most of the time because the program terminaison will free everything alloc'd. So the static issue is not a problem. It is stilltrue that for the local variable case, if the destructor is protected, it could be inconvenient. But I think (to adress Ian question as well) that only documenting that that the proper way to destroy an image from its pointer is to call release() ; should be enough, still I'll wait for your proposal :-) ./.. > Albrecht Fabien
_______________________________________________ fltk-dev mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk-dev
