makeing a copy of an object...
makeing a copy of an object...
- Subject: makeing a copy of an object...
- From: "Brian O'Brien" <email@hidden>
- Date: Tue, 1 Nov 2005 18:31:27 -0700
I realize this may be a reiteration of my previously stated problem.
I have a thread and it creates object and stores them in an
NSMutableArray.
The thread creates these objects between a:
for (;;)
{
NSAutorelease *pool = [[NSAutoreleasePool alloc] init];
... create lots and lots of autoreleased objects and store them
in my NSMutableArray
the objects are then passed off to a different thread..
[pool release];
}
As the main application doesn't know when the thread is going to
release the objects and thread doesn't know when the main application
is going to release the objects, I think it would be best if the main
thread
made copies of the objects of the thread and let the thread go on as if
there were no main application.....
- (id) getNextImage
{
id x;
x = [dataSets objectAtIndex:0];
[dataSets removeObjectAtIndex:0];
return x;
}
This is code in the thread that the main application calls to get an
instance of
one of the objects that the thread creates.
I assume that the main application should do:
id * myimage = [[sender getNextImage] copy];
So does this look right?
Does this mean that the class of object needs to implement a copy or
copyWithZone method?
Any help and corrections are appreciated...
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden