On 17 Aug 2011, at 23:18, Jerry Krinock wrote: > Although it's not mentioned in the 10.7 AppKit Release Notes, the various > methods involving document saving are invoked sequentially in 10.7, rather > than nested as they have always been, even if you have *not* enabled the new > asynchronous document saving feature. > > In the following lines, >> logs entering a method and << logs exiting. > > In Mac OS X 10.6, methods are run nested/stacked, and as documented [1]… > >>> [super saveDocument:] >>> [super >>> saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo:] >>> -[MyDocu saveToURL:ofType:forSaveOperation:error:] >>> -[MyDocu writeSafelyToURL:ofType:forSaveOperation:error:] >>> [super writeSafelyToURL:ofType:forSaveOperation:error:] > << [super writeSafelyToURL:ofType:forSaveOperation:error:] > << -[MyDocu writeSafelyToURL:ofType:forSaveOperation:error:] > << -[MyDocu saveToURL:ofType:forSaveOperation:error:] > << [super > saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo:] > << [super saveDocument:] > > In Mac OS X 10.7, they run sequentially, like this > >>> [super saveDocument:] > << [super saveDocument:] >>> [super >>> saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo:] > << [super > saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo:] >>> -[MyDocu saveToURL:ofType:forSaveOperation:completionHandler:] > << -[MyDocu saveToURL:ofType:forSaveOperation:completionHandler:] >>> -[MyDocu writeSafelyToURL:ofType:forSaveOperation:error:] >>> [super writeSafelyToURL:ofType:forSaveOperation:error:] > << [super writeSafelyToURL:ofType:forSaveOperation:error:] > << -[MyDocu writeSafelyToURL:ofType:forSaveOperation:error:] > > It does not matter whether or not you enable synchronous saving. That is, > -canAsynchronouslyWriteToURL:ofType:forSaveOperation: can either not be > implemented, return NO, or return YES. It appears from call stacks [2][3] > that their invocations are piled into a dispatch_sync type of queue. > > This means that if you had overridden, say, saveDocument:, and put some code > after invoking super, in 10.6 it runs after the actual save, but in 10.7 it > runs way before. Not even close.
I'd say that assuming any action method was done once super had returned was always a faulty assumption. Seeing as you knew it called an asynchronous method internally, you must have known that it might potentially return before saving is finished._______________________________________________ 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