Re: Document Architecture: saving or renaming a document overtop of an existing, open document
Re: Document Architecture: saving or renaming a document overtop of an existing, open document
- Subject: Re: Document Architecture: saving or renaming a document overtop of an existing, open document
- From: Jerry Krinock <email@hidden>
- Date: Wed, 05 Feb 2014 14:09:03 -0800
On 2014 Feb 05, at 13:30, Matthew LeRoy <email@hidden> wrote:
> Say I start my app, create a new document, make some edits, and save the document. Then, while leaving that document open, I create a second new document, make some changes, and then save it… overtop of the first document. I get the standard prompt that a document with the same name already exists — I choose “Replace”. The prompt sheet goes away, the title bar of the second document changes to reflect the saved name… and then it’s beach ball time. The app is dead.
Wow, I just reproduced the problem in TextEdit. It looks like the beach ball does not happen immediately, but possibly after auto save chimes up. I’ve seen this happen previously, but never figured out the Steps to Reproduce. Good work!
> The same thing happens if I save the second document by renaming it via the window’s title bar to the same name as the first saved document. Again, I get the “Replace?” prompt, and then the app hangs.
>
> I’m surprised the document architecture doesn’t account for this scenario — where a user renames or saves a document over top of an existing document that happens to also be open in the application, in a different window.
It is definitely one of the more serious NSDocument bugs I’ve seen since Auto Save was introduced in Lion.
> I tried doing the same thing in Pages 5.1 and Numbers 3.1, and both of them handle it by silently closing the first document once the user confirms they’d like to replace the existing document.
So apparently there is a workaround.
> The TextEdit sample app suffers the same hanging behavior that my app exhibits.
Cool :)
> I take it this is something I need to write code to deal with manually?
Unless some kind soul who has already found a workaround replies, I would advise against going down the NSDocument rabbit hole. Clear-cut and reproducible bugs like this are great for Technical Support Incidents. Ask Apple to provide the workaround which is apparently used in Pages and Numbers. If I didn’t have other tasks to complete today, I think I’d file one just out of curiosity.
_______________________________________________
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