• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Very different Document Saving in Lion, even without enabling asynchronous
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Very different Document Saving in Lion, even without enabling asynchronous


  • Subject: Re: Very different Document Saving in Lion, even without enabling asynchronous
  • From: Mike Abdullah <email@hidden>
  • Date: Thu, 18 Aug 2011 00:30:39 +0100

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 (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

  • Follow-Ups:
    • Re: Very different Document Saving in Lion, even without enabling asynchronous
      • From: Jerry Krinock <email@hidden>
References: 
 >Very different Document Saving in Lion, even without enabling asynchronous (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Very different Document Saving in Lion, even without enabling asynchronous
  • Next by Date: Re: How can I prevent drag-and-drop initiation in an NSTextField
  • Previous by thread: Very different Document Saving in Lion, even without enabling asynchronous
  • Next by thread: Re: Very different Document Saving in Lion, even without enabling asynchronous
  • Index(es):
    • Date
    • Thread