Re: many-to-many relationships and retain cycles

2008-06-03 Thread Ken Thomases
On Jun 2, 2008, at 11:12 AM, Todd Ransom wrote: Has anyone out there created a non-retaining array class or come up with another solution to this problem? Or is there anything in particular I should watch out for when subclassing NSMutableArray? Probably the non-retaining CFArray that other

Re: many-to-many relationships and retain cycles

2008-06-02 Thread Adam R. Maxwell
On Jun 2, 2008, at 10:01 AM, Jens Alfke wrote: On 2 Jun '08, at 9:12 AM, Todd Ransom wrote: It seems that what I need is a non-retaining array. I googled around a bit and was surprised that I could not find an existing implementation. It looks like I can create one by subclassing NSMutabl

Re: many-to-many relationships and retain cycles

2008-06-02 Thread Todd Ransom
Thanks guys. I decided to just use CFArrayCreateMutable in my accessor instead of creating a subclass and it's working beautifully. Todd Ransom Return Self Software http://returnself.com On Jun 2, 2008, at 1:01 PM, Jens Alfke wrote: On 2 Jun '08, at 9:12 AM, Todd Ransom wrote: An actor h

Re: many-to-many relationships and retain cycles

2008-06-02 Thread j o a r
On Jun 2, 2008, at 10:04 AM, Jens Alfke wrote: If you're only targeting Leopard or later, you might want to take a look at "NSPointerArray". That is So. Awesome. I've been using Leopard for like two years now, and I'd never noticed this class before. Thanks for the tip! It is pretty awe

Re: many-to-many relationships and retain cycles

2008-06-02 Thread Jens Alfke
On 2 Jun '08, at 9:32 AM, j o a r wrote: If you're only targeting Leopard or later, you might want to take a look at "NSPointerArray". That is So. Awesome. I've been using Leopard for like two years now, and I'd never noticed this class before. Thanks for the tip! An array you can store

Re: many-to-many relationships and retain cycles

2008-06-02 Thread Jens Alfke
On 2 Jun '08, at 9:12 AM, Todd Ransom wrote: An actor has a scenesForActor mutableArray and a scene has an actorsForScene mutableArray. This all works great except that it creates retain cycles and neither actor nor scene objects are ever released if they have a relationship. Yeah, this

Re: many-to-many relationships and retain cycles

2008-06-02 Thread Michael Vannorsdel
I've never tried it personally, but you might make a CFMutableArray with NULL callbacks and then cast it to an NSMutableArray since they're bridged types. On Jun 2, 2008, at 10:36 AM, Todd Ransom wrote: Unfortunately I need to target Tiger also. Thanks for the info, though, this will be u

Re: many-to-many relationships and retain cycles

2008-06-02 Thread Todd Ransom
Unfortunately I need to target Tiger also. Thanks for the info, though, this will be useful to know in a year or so. ;) Todd Ransom Return Self Software http://returnself.com On Jun 2, 2008, at 12:32 PM, j o a r wrote: On Jun 2, 2008, at 9:12 AM, Todd Ransom wrote: It seems that what I n

Re: many-to-many relationships and retain cycles

2008-06-02 Thread j o a r
On Jun 2, 2008, at 9:12 AM, Todd Ransom wrote: It seems that what I need is a non-retaining array. I googled around a bit and was surprised that I could not find an existing implementation. It looks like I can create one by subclassing NSMutableArray, overriding the primitive methods, and

many-to-many relationships and retain cycles

2008-06-02 Thread Todd Ransom
I have an application that allows users to create relationships between certain objects. For instance, there are scene objects and actor objects (like in a movie). The user can add multiple actors to a scene and an actor can participate in multiple scenes. A classic many- to-many relationshi