The Omni Group Forums

The Omni Group Forums (
-   Omni Frameworks (
-   -   Spinning FileCoordinator Notification (

SpiraMira 2012-01-31 02:28 PM

Spinning FileCoordinator Notification
Hi -

I implemented a custom OUIDocument class and used (NSData) dataWithContentsOfURL:options:error in my - (BOOL)ReadFromURL:error: override. Thought I was being smart by specifying NSDataReadingMappedIfSafe as an option only to realize (after a few sleepless nights) that it causes endless OFSDocumentStoreFileItem:presentedItemDidChange notifications which in turn posts OFSDocumentStoreFileItemContentsChangedNotification.

This is fixed by using the simple (no option version) of dataWithContentsOfURL OR the following options:
NSDataReadingUncached - works
NSDataReadingMappedAlways - works

At this point, I'm just wondering why the NSDataReadingMappedIfSafe read option causes this behavior.
Just curious.

Thanks in advance.

Tim Wood 2012-01-31 11:26 PM

I haven't hit this case -- I suppose NSData could be doing a coordinated read in this case, which might cause file presenters (maybe including the document) to be asked to yield to readers (writing their changes).

I don't see anything in the documentation about NSData doing coordinated reads in this case, though. Presumably the TextEditor sample could be changed to replicate the problem -- it would be interesting to see if hear if you hit the problem in this case.

SpiraMira 2012-02-01 02:19 AM

Sure - I'll try and replicate with TextEdit.

All times are GMT -8. The time now is 06:14 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.