Just as a follow up to this - the reason for the hack below is that
subscribing to events from IronPython is still causing our UI objects
(and their whole object graphs) to not be garbage collected. This was a
brute force way of clearing out subscribed events so that unneeded UI
components can then be garbage collected.
A 'RemoveAll' trick for event handlers, or IronPython's cache of
handlers to delegates, would save us a lot of work.
Michael Foord
Glenn Jones wrote:
In Resolver One on IronPython 1, we have code to unhook events that
uses an object that is equal to everything like this:
e = EqualToAll()
for _ in range(100):
event -= e
What we have discovered when we run under IPy2, is that the __eq__
method on EqualToAll is only called when the target of the event is a
lambda, a function or a callable object but not when it's a method.
Is there a better way to unhook all events or get a list of currently
subscribed targets? For the moment, we're going to wrap our event
targets in lambdas as a way to move forward, but the whole EqualToAll
and arbitrary looping seems a little dirty anyway.
Thanks
Glenn & Will
------------------------------------------------------------------------
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
--
http://www.ironpythoninaction.com/
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com