Retaining a NSURL and retaining its -path
Retaining a NSURL and retaining its -path
- Subject: Retaining a NSURL and retaining its -path
- From: John Love <email@hidden>
- Date: Sat, 12 Sep 2009 12:43:42 -0400
In my controller, one of my instance variables is a NSURL and I retain
it because I pass it to a 2nd controller. In my second controller, I
extract [myURL path] and look at it in a secondary thread loop and
everything works fine. I began to think if I could eliminate that
call to [myURL path] every time through that loop I would save "some"
time.
My first attempt was to pass that NSURL in the same manner and then
place the extracted [myURL path] into an instance variable of the 2nd
controller. Okay so far .. and then I assumed that if myURL was
retained in the 1st controller, then "naturally" its NSString -path
was also retained .. but it crashed with "release message sent to a
already released object" (or something like that). Only when I
extracted the -path *and* retained it before I stored it as an
instance variable of the 2nd controller did it work.
Basic question: if a parent object is retained, why isn't each sibling
component object of that parent retained??
John Love
Touch the Future! Teach!
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden