Re: Advice on document handling
Re: Advice on document handling
- Subject: Re: Advice on document handling
- From: Graham Cox <email@hidden>
- Date: Tue, 10 Jun 2014 13:14:51 +1000
On 10 Jun 2014, at 11:28 am, John Brownie <email@hidden> wrote:
> I think that the problem is likely to involve the fact that documents can be owned by both the bundle document class and the simple document class, and trying to save the same document may be leading to the problem.
But is it the same file?
It's not clear from your description whether you have two different document objects managing the same 'unbundled' file, it sounds as if it's only the same file TYPE. I can't see that would cause a problem. But if there's a situation where you can have the same disk file managed by two different document objects, one bundled and the other not, that would probably be a problem.
Do you save your unbundled file as a bundled file? Or does bundled/unbundled always remain distinct? If so the only way it could happen would be if you opened the raw file from within its package while the package itself was already open, which is really an error situation - so you might want to consider checking for that possibility if it's considered likely enough.
I have a similar situation in my app actually, where I can open a 'raw' document file and one that embeds the exact same file type in a bundle (actually the term is 'package'). But I handle this using the same document class - the method -readFromURL:ofType:error: takes different pathways to deal with the file based on type. On save, the type again is used to only package the file that was previously packaged, raw stays raw. That said, having separate document classes shouldn't affect that, though in my case it doesn't make sense because all of the different files open the same UI, windows, data model, etc. I've not run into problems with deadlocks, though thinking about it I probably could if I forced it to open a file from inside an open package - I haven't bothered checking for that because I do consider it unlikely to occur by accident.
--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