I’m getting a weird experience in my document-based application while doing 
something that I thought surely would have been accounted for automatically by 
the document architecture. Namely, saving (or renaming) a document overtop of 
an existing document which is also open in the app.

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.

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.

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. The TextEdit sample app suffers the same 
hanging behavior that my app exhibits.

I take it this is something I need to write code to deal with manually? Or is 
there something in the document architecture that I’m missing that will help me 
deal with or otherwise avoid this problem?

Matt
_______________________________________________

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