[IronPython] IP as a Macro Language

Michael Foord fuzzyman at voidspace.org.uk
Fri Apr 18 17:20:52 CEST 2008


Curt Hagenlocher wrote:
> On Fri, Apr 18, 2008 at 2:00 AM, Dave Moor <d.moor at sim-soft.co.uk> 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
> curt at hagenlocher.org
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>   




More information about the Ironpython-users mailing list