Re: NSThread with Distributed Objects
Re: NSThread with Distributed Objects
- Subject: Re: NSThread with Distributed Objects
- From: Mike Laster <email@hidden>
- Date: Wed, 14 Aug 2002 12:03:48 -0400
On 8/13/02 5:04 PM, "John Nairn" <email@hidden> wrote:
>
I have a program that I am trying to convert to multiple threading but I
>
am stopped by a confusing error. This program uses distributed objects
>
with a calculation thread to create plotting objects and a main thread
>
where all interface commands are done. As far as I know, the
>
calculation thread never calls the AppKit. All seems to work OK, but
>
when the calculation thread is over and the main thread is drawing the
>
objects, the following error appears:
>
>
2002-08-13 14:55:14.860 ScienceCocoa[2928] *** -[NSCalibratedRGBColor
>
viewBounds]: selector not recognized
>
>
This occurs when the drawing code is calling a class that was created in
>
the main thread and filled with data in the calculation thread. The
>
class is called "PlotHeader" and its single instance variable is
>
"plotObjects". This error seems to come when the main thread tries the
>
mssage
>
>
[plotObjects viewBounds]
>
>
and Objective C seems to now think plotObjects has become an
>
NSCalibratedRGBColor instead of what is was before. The error is usually
>
of this form, but sometimes other errors occurs which I expect are also
>
because Objective C somehow no longer knows that plotObjects is pointing
>
to a PlotHeader object.
>
>
Does this error make sense or any ideas what causes it?
>
>
P.S.: The code works fine when non threaded.
It sounds like your object is getting dealloced and then you attempt to
access it later. Try running with the following environment variables set:
NSZombieEnabled = YES
NSAutoreleaseFreedObjectCheckEnabled = YES
You should see the code complaining if you attempt to access a dealloced
object.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.