On 29 Aug 2011, at 22:05, Kyle Sluder wrote:
> Saving during loading will now deadlock on Lion, since you're trying to do a
> coordinated write while NSDocumentController still has a coordinated read on
> your file. Don't save while loading.
>
> Does -takkeEvent: happen in response to NSUndoManager notifications?
> Something could be poking the NSUndoManager.
No NSUndoManager used.
But it worked in Snow Leopard like this:
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
activeDoc = [ sDC openDocumentWithContentsOfURL: absoluteURL display:
YES error: &outError ];
... add some data to activeDoc
[ activeDoc saveDocument: nil];
}
But it seems that opening and saving in the same event does not work in Lion
(and this open method is deprecated in Lion).
So I replaced this with:
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
[ sDC openDocumentWithContentsOfURL: absoluteURL display: YES
completionHandler: ^(NSDocument *document, BOOL documentWasAlreadyOpen, NSError
*error)
{
[ self completeDidFinishLaunching: (MyDocument *)document ];
}
];
}
- (void)completeDidFinishLaunching: (MyDocument *)doc;
{
activeDoc = doc;
... add some data to activeDoc
[ activeDoc saveDocument: nil];
}
And now this bug has disappeared.
Thanks for pointing me in the right direction.
Kind regards,
Gerriet.
_______________________________________________
Cocoa-dev mailing list ([email protected])
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]