FYI that bug should be fixed in 2.0. We now use weak references on both the handler and the target so we don't keep things alive.
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Michael Foord Sent: Friday, April 18, 2008 8:21 AM To: Discussion of IronPython Subject: Re: [IronPython] IP as a Macro Language Curt Hagenlocher wrote: > On Fri, Apr 18, 2008 at 2:00 AM, Dave Moor <[EMAIL PROTECTED]> wrote: > >> My problem is, I can create a form entirely in IP but I can't seem to >> get it added as a MDIChild to the main application, and when the form is >> closed the form's timer is still running in the background requesting >> data from the main application. >> > > For the most part, anything you can do along these lines from C# can > also be done from within IronPython. Can you provide a snippet of > Python code that shows the approach that wasn't working for you? > > >> I gather from this list that IP has problems destroying C# objects it >> has instantiated and I assume that it has problems responding to events >> triggered from the CLR side. >> > > Both IronPython and C# rely on the same underlying CLR garbage > collector, so there really shouldn't be any difference in this regard. > Could you be storing a reference to the form from Python code which > would prevent garbage collection? For instance, if you assign the > form to a module-level variable, it will probably never be destroyed > because the module itself is kept alive by a reference from > sys.modules. > We also had an issue where adding python functions/methods as event handlers would keep forms alive as IronPython stores a mapping of handler functions to delegates. Explicitly unsubscribing to events on disposal solved that problem - but it was a lot of work. Michael > -- > Curt Hagenlocher > [EMAIL PROTECTED] > _______________________________________________ > Users mailing list > Users@lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com