On 2011 Aug 04, at 07:53, Ken Thomases wrote:

> On Aug 4, 2011, at 8:54 AM, Jerry Krinock wrote:
> 
>> I'm getting a crash if I begin some operations and then hit the 'close' 
>> button on the window while the operations are in progress…
>> 
>> I take the four parameters I receive in 
>> saveToURL:ofType:forSaveOperation:completionHandler: and put them into a 
>> dictionary in an NSOperation, and throw this operation onto the end my 
>> operation queue.  (This project was written back in 10.5 so it does not use 
>> GCD.)  
> 
> Did you copy the block, or did you just add it to the dictionary as a value 
> (which just retains it)?

The latter, Ken.  I didn't mention that I was a newbie on Blocks, having just 
read "Blocks Programming Topics" yesterday.  "Copying Blocks" was near the end 
… looks like I must have fallen asleep.

> This suggests that you didn't copy it.  Thus, the above is the first time it 
> has been copied, which attempts to relocated it off of its original stack 
> frame and into the heap.  However, that stack frame is long gone and no 
> longer valid.

Yup.

> Blocks have special memory management requirements and retaining is not 
> sufficient if the block is to survive its original stack frame.

OK, I'll go do the homework.

Thank you.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to