On Apr 19, 2013, at 15:42:05, Jerry Krinock <je...@ieee.org>
 wrote:

> That's a damned good question, Mike.  You're probably thinking that, hey, we 
> lived without any autosaves from 1984 to 2011.  What's the big deal?  It 
> turns out that you need to be really careful when playing around with an 
> autosave that Cocoa has designated "not implicitly cancellable".  Search the 
> internet for:
> 
>    deadlock in -[NSDocument performActivityWithSynchronousWaiting:usingBlock:]
> 
> to see some of the fun that people have had.
> 
> I have an app with a requirement similar to Steve's.  The app can do 
> long-winded sequences of operations that take tens of seconds, and change the 
> document.  So if I honored an autosave request during one these sequences, 
> I'd have to interrupt the operations (which is tricky), save, and then save 
> again at the end after the changes were done.
> 
> The solution: Upon receiving a non-cancellable autosave message while other 
> operations are in progress, I stash the completion handler that Cocoa sends 
> in the message, create an operation to "really autosave" later, and add it to 
> my operation queue.
> 
> I had to do other stuff to deal with corner cases such as Revert, being in 
> the Versions Browser, etc.  Below, I've snipped out a few of the relevant 
> methods from my NSDocument (actually it's NSPersistentDocument, which adds 
> even more to the mess) implementation.

<snip>

Heh, I just happened to run across some part of your previous thread while 
searching for answers right before your message arrived. :)

Holy carp. That's a lot of complicated stuff to do just to do something as 
simple as temporarily disable autosave. I appreciate the debugging work it took 
for you to understand the complexity of what happens when you cancel autosave. 
I really don't want to add so much complexity to this, when all I'm trying to 
do is replicate the autosave behavior our app had before moving to Cocoa. Turn 
it on, pause it during playback, resume it. Piece of pie. I'm going to try a 
different tactic for now and only come back to this if it doesn't work out. 
Thanks for the snippets, Jerry!

--
Steve Mills
office: 952-818-3871
home: 952-401-6255
cell: 612-803-6157




_______________________________________________

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

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

Reply via email to