• 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: coredata framework daemon-safe?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: coredata framework daemon-safe?


  • Subject: Re: coredata framework daemon-safe?
  • From: Bill Bumgarner <email@hidden>
  • Date: Wed, 17 May 2006 08:47:00 -0700

On May 17, 2006, at 2:10 AM, P Smith wrote:
Multiple threads might be using the class I have implemented. Each
time I need to add the entry to the database, I create instance of
NSManagedObjectContext and release it after the operation is
completed.

I would recommend checking your threading code very carefully. There may be a case where you have two threads stomping on each other or you are diddling the same MOC from two threads or the same entities from two threads.


Generally, one would create a managed object context per thread and allow said MOC to exist throughout the lifetime of the thread.

Does the daemon always crash?

Are you passing data between threads or modifying managed objects between threads?

Since this is crashing in _NSRaiseError(), something is hosed in your MOC (or underlying PSC) such that the attempt to compose the error is crashing.

(relatively straightforward code example deleted)

>  Entity *entity = [[[Entity alloc] initWithEntity:myEntity
>           insertIntoManagedObjectContext:moc] autorelease];
>
>       [ myEntity setName : [NSString stringWithCString: fileName]];

This looks a bit odd. entity then myEntity?

Something similar to the example code:

NSEntityDescription *runEntity = [[mom entitiesByName] objectForKey:@"Run"];
Run *run = [[[Run alloc] initWithEntity:runEntity
insertIntoManagedObjectContext:moc] autorelease];

OK -- I'm assuming a copy/paste/edit bug, but that second line should be [entity setName: ...];


As MMalc indicated, stringWithCString: is deprecated, but that shouldn't be causing the crash.

b.bum



_______________________________________________
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


References: 
 >coredata framework daemon-safe? (From: "P Smith" <email@hidden>)
 >Re: coredata framework daemon-safe? (From: Bill Bumgarner <email@hidden>)
 >Re: coredata framework daemon-safe? (From: "P Smith" <email@hidden>)
 >Re: coredata framework daemon-safe? (From: Bill Bumgarner <email@hidden>)
 >Re: coredata framework daemon-safe? (From: "P Smith" <email@hidden>)

  • Prev by Date: Re: Authentication & suid tool
  • Next by Date: Re: programmatically determining if the machine is intel or not
  • Previous by thread: Re: coredata framework daemon-safe?
  • Next by thread: Using SenTestingKit for testing a framework
  • Index(es):
    • Date
    • Thread