I have a scenario where in one region of the app I have a collection managing models. In other places (ie, within Controllers) I have manipulation and lifecycle management of those models. A controller may dispose of a model.
It would be clean for the collection to be alerted via an event when a model is disposed of, so I can do things like remove this disposed object from the collection. class Foo : NSObject { public event EventHandler Disposed; protected override void Dispose(bool disposing) { base.Dispose(disposing); if (disposing && Disposed != null) { // Alert listeners who might want to clean up state // based on the disposal of this instance. Disposed(this, new EventArgs()); } } } *Question*: I'm wondering, is this a recipe for a memory leak? If I have something listening to a *Disposed *event, and then at the moment that object is disposed of, some other reference kicks off into action using the object. Would that pull it out of the queue for the GC to deal with? Or once *Dispose* has been called, is the end inexorable? I'm not doing any actual work with it - I'm just getting it out of my collection and clean up associated state. Thanks for any insights guys! -- *Phil *Cockfield
_______________________________________________ MonoTouch mailing list MonoTouch@lists.ximian.com http://lists.ximian.com/mailman/listinfo/monotouch