Re: NSThread question
Re: NSThread question
- Subject: Re: NSThread question
- From: "Mike Vannorsdel" <email@hidden>
- Date: Tue, 10 Jul 2001 15:40:20 -0600
You still need a [pool release] at the end of doImage. But the real
problem is that you shouldn't do any GUI work from a secondary thread.
GUI drawing should be done in the main thread while calculations in the
secondary thread. Quite a bit of the AppKit is not really thread safe.
On Tuesday, July 10, 2001, at 05:44 AM, Aurilien wrote:
I still have an error (signal 10 (SIGBUS)). I'll explain exactly what I
do:
I have a -(void)doImage; method in a custom NSView object. This is the
method I'm calling in the new Thread, and it goes like this:
-(void)doImage
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc ] init];
[ self display ];
}
the method in which I call it goes like this:
-(void) setData:(NSData *) data
{
myData = [[NSData alloc] initWithData:data];
cachedImage = nil;
[NSThread detachNewThreadSelector:@selector(doImage) toTarget:self
withObject:nil];
}
Still obscure to me what causes the crash...