• 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
makeing a copy of an object...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: makeing a copy of an object...
      • From: Shawn Erickson <email@hidden>
  • Prev by Date: Re: Changes in CoreData/10.4.3?
  • Next by Date: Accessors for 2D Arrays?
  • Previous by thread: Re: Control the dirty/clean dot in the red "Close" button
  • Next by thread: Re: makeing a copy of an object...
  • Index(es):
    • Date
    • Thread