• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Blocked in NSFileCoordinator
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Blocked in NSFileCoordinator


  • Subject: Re: Blocked in NSFileCoordinator
  • From: "Gerriet M. Denkmann" <email@hidden>
  • Date: Tue, 30 Aug 2011 01:11:31 +0700

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@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

References: 
 >Blocked in NSFileCoordinator (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: Blocked in NSFileCoordinator (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: ARC + CF types
  • Next by Date: Re: ARC + CF types
  • Previous by thread: Re: Blocked in NSFileCoordinator
  • Next by thread: Saving PNG files from NSImage
  • Index(es):
    • Date
    • Thread