• 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: NSUndoManager messing up Core Data database
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSUndoManager messing up Core Data database


  • Subject: Re: NSUndoManager messing up Core Data database
  • From: Ruotger Skupin <email@hidden>
  • Date: Thu, 9 Oct 2008 12:21:17 +0200

Hi Ron,

I wasn't clear enough on one point. The main thread context's undo manager crashes (the posted backtrace), but changing the DB only happens in the background thread. Assuming no binding changes the main thread context, there shouldn't be anything to undo in the main thread context. I cannot be 100% sure the bindings behave read-only when they should, of course.

btw.: I'd like to propose that there should be a way to switch a context to read-only. I'd file a radar if you want me to.

Am 08.10.2008 um 18:23 schrieb Ron Lue-Sang:


The background thread (called database access thread) is the one that changes the database exclusively, all database modifying is funnelled through it. The main thread is supposed to only read- access the database. How do I do that? Since I already use mogenerator (http://rentzsch.com/code/mogenerator) I changed the generator template to check for the correct thread on write access. That way I could pinpoint a lot of accidental write accesses, which led to context inconsistencies.

There's one I could not get rid of. It is done by the NSUndoManager. Which is weird as there is no write access to the database from the main thread the NSUndoManager is so keen on undoing. What is going on?

In my case I'd like to get rid of the NSUndoManager altogether as I don't need it. Is there a way to do that?


Well, the short answer is:
backgroundManagedObjectContext = [[NSManagedObjectContext alloc] init];
[backgroundManagedObjectContext setUndoManager:nil];


But that's assuming that the undoManager in frame 15 of your bt is [backgroundManagedObjectContext undoManager]. I think that's the only way you'd get into the situation you've described.


-------------------------- RONZILLA




Ruotger

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >NSUndoManager f@*#ing up Core Data database (From: Ruotger Skupin <email@hidden>)
 >Re: NSUndoManager f@*#ing up Core Data database (From: Ron Lue-Sang <email@hidden>)

  • Prev by Date: Re: NSUndoManager f@*#ing up Core Data database
  • Next by Date: Re: corrupt coredata DB
  • Previous by thread: Re: Multithreaded Core Data app design
  • Next by thread: Re: NSUndoManager f@*#ing up Core Data database
  • Index(es):
    • Date
    • Thread