• 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: How to cancel a loading document in NSDocument's readFromURL:ofType:error method ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to cancel a loading document in NSDocument's readFromURL:ofType:error method ?


  • Subject: Re: How to cancel a loading document in NSDocument's readFromURL:ofType:error method ?
  • From: Mike Abdullah <email@hidden>
  • Date: Fri, 10 Feb 2012 22:25:26 +0000

On 10 Feb 2012, at 21:25, Gilles Celli wrote:

> Opening the ASCII file can take up to 15-20 sec ( > 150MB), so I made some changes as you suggested by moving the progressWindowController  alloc/init before the allocation of asciiFileContents...
> And you're right I should have put addWindowController: in makeWindowController....
>
> This makes the opening of the file a little more responsive (clicking the button) but not really what I expect...
>
>> Never blindly assign to error pointers. Check the caller is actually interested in receiving an error first.
> Which caller do you mean ?

Cocoa is calling your method. You should do:

if (outError) *outError = …

Otherwise it'll crash should outError be nil. The static analyser can warn you of this.
>
> Maybe the way to go is to use a new detached thread only for the progress window, or to use Kyle's approach by using NSOperationQueue..

Again I repeat: AppKit is NOT thread safe. You must perform all UI on the main thread. You already have a detached thread. There is likely no point trying to start up another one.
_______________________________________________

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: 
 >How to cancel a loading document in NSDocument's readFromURL:ofType:error method ? (From: Gilles Celli <email@hidden>)
 >Re: How to cancel a loading document in NSDocument's readFromURL:ofType:error method ? (From: Kyle Sluder <email@hidden>)
 >Re: How to cancel a loading document in NSDocument's readFromURL:ofType:error method ? (From: Gilles Celli <email@hidden>)
 >Re: How to cancel a loading document in NSDocument's readFromURL:ofType:error method ? (From: Mike Abdullah <email@hidden>)
 >Re: How to cancel a loading document in NSDocument's readFromURL:ofType:error method ? (From: Gilles Celli <email@hidden>)
 >Re: How to cancel a loading document in NSDocument's readFromURL:ofType:error method ? (From: Mike Abdullah <email@hidden>)
 >Re: How to cancel a loading document in NSDocument's readFromURL:ofType:error method ? (From: Gilles Celli <email@hidden>)

  • Prev by Date: Re: How to cancel a loading document in NSDocument's readFromURL:ofType:error method ?
  • Next by Date: Re: Lion: Lock documents and custom undomanager
  • Previous by thread: Re: How to cancel a loading document in NSDocument's readFromURL:ofType:error method ?
  • Next by thread: Re: How to cancel a loading document in NSDocument's readFromURL:ofType:error method ?
  • Index(es):
    • Date
    • Thread