Re: Unexpected extra "change" notification in 10.10
Re: Unexpected extra "change" notification in 10.10
- Subject: Re: Unexpected extra "change" notification in 10.10
- From: Graham Cox <email@hidden>
- Date: Tue, 25 Nov 2014 08:43:03 +1100
> On 24 Nov 2014, at 12:55 pm, Jerry Krinock <email@hidden> wrote:
>
> To clarify the issue: -updateChangeCount: is called, as expected, when you dirty the document. It is called again when you save the document, apparently just after you save the document, because
>
>> This causes the document to be flagged as dirty, prompting the "Save changes?" dialog when it's closed (if that is enabled).
>
>
> It is the second call to -updateChangeCount:, which occurs during/after the save, that is the issue. Have I understood correctly?
Yes. The -updateChangeCount: mechanism is working normally for genuine changes, which are sent as the result of a notification from the undo manager. I'm getting an extra one after the save completes, but only for the first save, and only if it creates a new file rather than overwriting an existing one.
>> It doesn't seem as if I'm doing anything wrong as we're not seeing this except on 10.10
>
> See if it’s putting an action on the undo stack. If that is too opaque, which it will probably will be if app is Core Data, consider the "Dave Fernandes Override -willChangeValueForKey: Trick":
It's not. A change from the undo manager has a completely different stack trace, where the undo manager sends a synchronous notification via NSNotificationCenter. This one seems to be something in the run loop (a queued task?) triggering a direct call to -[NSDocument _checkAutosavingThenUpdateChangeCount:]_block_invoke_2 () which is most definitely something internal and private and not something my code has (knowingly) set up.
--Graham
_______________________________________________
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