18 Jul 17:11
Re: Does a sync_trait connection prevent an object from being garbage collected?
From: Alexander Michael <lxander.m@...>
Subject: Re: Does a sync_trait connection prevent an object from being garbage collected?
Newsgroups: gmane.comp.python.enthought.devel
Date: 2008-07-18 15:11:10 GMT
Subject: Re: Does a sync_trait connection prevent an object from being garbage collected?
Newsgroups: gmane.comp.python.enthought.devel
Date: 2008-07-18 15:11:10 GMT
On Fri, Jul 18, 2008 at 11:07 AM, David C. Morrill <dmorrill@...> wrote: > Alexander Michael wrote: >> If after setting up a sync_trait pair one side of the sync (the one >> past in the argument to the sync_trait method) leaves scope with >> nothing referencing it other than the sync_trait event handling (or >> even gets explicitly deleted with the del operator) does the object >> get garbage collected and the sync_trait connection removed? Or does >> the sync_trait setup keep it dangling until I explicitly remove the >> sync'ing with another call to sync_trait with remove=True? >> >> I'm trying to figure out how explicit I need to be about setting up >> and tearing down some wiring in my app in response to user >> interactions that essentially reconfigure the object relationships. > > By design, traits listeners (and sync_traits, which sets up some > listeners) do not keep either party alive. You will have to save > explicit references to objects if you want them to not be GC'ed... Great! I want them to be GC'ed without too much book keeping on my part, so this is the answer both that I was hoping for and that I thought was the case. Thanks, Alex
RSS Feed