Hello. I'm adding a undo system into the software I am developing. I created a TObject derived class to handle the data required to perform a 1 level undo/redo. However, I am concerned about the memory being allocated and freed.
The class does not allocate any memory, just initializes it's own variables. I am adding each TpmUndo object into the list view like this lvPM.AddItem(caption, TpmUndo.Create(a pointer to a abstract object)); And in a OnDeletion event, I added TpmUndo(Item.Data).Free; I should know better, but I can't think of any other way to handle the memory being allocated for each undo object I'm adding to the list. I know that when you create something, you need to free it. I am questioning if the OnDeletion event is freeing that object's memory. So far I dont have any problems with this, but perhaps you can tell me if there is still memory leaks or perhaps a better way to add a TpmUndo object into the list? __________________________________________________ Delphi-Talk mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi-talk
