Why does NSDocument do this?
Why does NSDocument do this?
- Subject: Why does NSDocument do this?
- From: Graham Cox <email@hidden>
- Date: Fri, 22 Nov 2013 12:50:29 +0100
Opening files concurrently.
When I open a single file, it opens fine and shows up initially unedited (not dirty), as expected.
If I open several files by choosing multiple items in the NSOpenPanel, some of them get dirtied when they open. I’ve overridden -updateChangeCount: to see who’s doing this, and the stack trace is:
#0 0x00000001000ac298 in -[GCOrteliusDocument updateChangeCount:] at […]GCOrteliusDocument.m:1554
#1 0x00007fff8d8fb40f in __52-[NSDocument _checkAutosavingThenUpdateChangeCount:]_block_invoke_3 ()
#2 0x00007fff8d8fabed in -[NSDocument _checkAutosavingThenContinue:] ()
#3 0x00007fff8d8fb2ca in __52-[NSDocument _checkAutosavingThenUpdateChangeCount:]_block_invoke_2 ()
#4 0x00007fff8a7c67cc in __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ ()
#5 0x00007fff8a7b7ee5 in __CFRunLoopDoBlocks ()
#6 0x00007fff8a7b77de in __CFRunLoopRun ()
#7 0x00007fff8a7b7275 in CFRunLoopRunSpecific ()
#8 0x00007fff86899f0d in RunCurrentEventLoopInMode ()
#9 0x00007fff86899cb7 in ReceiveNextEventCommon ()
#10 0x00007fff86899abc in _BlockUntilNextEventMatchingListInModeWithFilter ()
#11 0x00007fff8d45c28e in _DPSNextEvent ()
#12 0x00007fff8d45b8db in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] ()
#13 0x00007fff8d44f9cc in -[NSApplication run] ()
#14 0x00007fff8d43a803 in NSApplicationMain ()
Which doesn’t enlighten me much, but it points the finger entirely at framework code as far as I can tell. This is always called on the main thread, even though files are being opened on other threads. Even more oddly, when I close these dirtied documents, I am prompted to revert or save (which is why it’s so annoying), but if I revert another document gets dirtied!
There’s something weird going on, but I’m having trouble even figuring out the pattern here.
Has anyone else come across this?
—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