• 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: [SOLVED!] Progress Sheet on a NSDocument
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [SOLVED!] Progress Sheet on a NSDocument


  • Subject: Re: [SOLVED!] Progress Sheet on a NSDocument
  • From: glenn andreas <email@hidden>
  • Date: Sun, 25 Mar 2007 12:03:50 -0500


On Mar 25, 2007, at 11:30 AM, Alan Smith wrote:

No, I didn't start it from a thread other than the main one

Yes you did.



- (void)threadedSaveMovieToPath:(NSString*)path { [NSThread detachNewThreadSelector: @selector(saveMovieToPath:) toTarget: self withObject: path]; }

This tells saveMovieToPath to be performed on a new thread (which will not be the main thread)



- (void)saveMovieToPath:(NSString*)path { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; stopProcess = NO; [progressPanel beginModalForWindow: [self windowForSheet] modalDelegate: self didEndSelector: @selector(sheetDidEnd: returnCode: contextInfo:) contextInfo: nil];

And so when it gets here, beginModalForWindow is being called from a secondary thread.



You just plain can't do UI from any thread other than the main one.

If your saving code takes a long time, you should perform all the UI in the main thread (so your savePanelDidEnd routine shouldn't be calling a routine to spawn a new thread), and then in the sheetDidEnd... routine, _there_ is where you spawn off a thread with the appropriate parameters.



Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
quadrium2 | build, mutate, evolve, animate | images, textures, fractals, art



_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: 
 >Progress Sheet on a NSDocument (From: "Alan Smith" <email@hidden>)
 >Re: Progress Sheet on a NSDocument (From: Ashley Clark <email@hidden>)
 >Re: Progress Sheet on a NSDocument (From: "Alan Smith" <email@hidden>)
 >Re: Progress Sheet on a NSDocument (From: Dominik Pich <email@hidden>)
 >Re: Progress Sheet on a NSDocument (From: "Alan Smith" <email@hidden>)
 >[SOLVED!] Progress Sheet on a NSDocument (From: "Alan Smith" <email@hidden>)
 >Re: [SOLVED!] Progress Sheet on a NSDocument (From: Andreas Mayer <email@hidden>)
 >Re: [SOLVED!] Progress Sheet on a NSDocument (From: "Alan Smith" <email@hidden>)

  • Prev by Date: Re: binding bool value??
  • Next by Date: Re: [SOLVED!] Progress Sheet on a NSDocument
  • Previous by thread: Re: [SOLVED!] Progress Sheet on a NSDocument
  • Next by thread: Re: [SOLVED!] Progress Sheet on a NSDocument
  • Index(es):
    • Date
    • Thread