Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1735
Handle object cleanup when object falls off the UndoHistory list
posted

Hi,

I've started looking into the Undo/Redo framework, and have a scenario I currently fail to find a quick solution to in the documentation.

The issue is that my undo transactions will involve objects that need some cleanup before being garbage collected. This may include detaching event handlers and/or deleting some files on disk. If I e.g. delete such objects from my object graph within an undo transaction I obviously can't clean them up immediately, since the objects may be brought back during a redo. What I need is a way to clean up these objects when they fall off the UndoHistory and are gueranteed to be gone forever.

What is the recommended pattern to solve this issue  ?

Regards,
Leif