• 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
NSUndoManager f@*#ing up Core Data database
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSUndoManager f@*#ing up Core Data database


  • Subject: NSUndoManager f@*#ing up Core Data database
  • From: Ruotger Skupin <email@hidden>
  • Date: Wed, 8 Oct 2008 13:17:28 +0200

Hi,

I have a core data database with two contexts attached to it. One read- only for the main thread and bindings, one read/write for a background thread that takes data from the network and feeds it into the database. I know this is an effed-up design you shouldn't copy, but it won't change.
(For why this is a bad idea: http://lists.apple.com/archives/Cocoa-dev/2007/May/msg00066.html but please let's not discuss this here, thx)


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?

#1 0x00045652 in -[_GBEbayItem setDetails:] at _GBEbayItem.m:812
#2 0x97009f14 in -[NSManagedObject(_NSInternalMethods) _propagateDelete]
#3 0x970099b4 in -[NSManagedObjectContext(_NSInternalChangeProcessing) _propagateDeletesUsingTable:]
#4 0x970096df in -[NSManagedObjectContext(_NSInternalChangeProcessing) _processDeletedObjects:]
#5 0x96fc7398 in -[NSManagedObjectContext(_NSInternalChangeProcessing) _propagatePendingDeletesAtEndOfEvent:]
#6 0x96fc6f69 in -[NSManagedObjectContext(_NSInternalChangeProcessing) _processRecentChanges:]
#7 0x96fdabea in -[NSManagedObjectContext processPendingChanges]
#8 0x970033a5 in - [NSManagedObjectContext(_NSInternalNotificationHandling) _processEndOfEventNotification:]
#9 0x953152dc in _nsnote_callback
#10 0x94803aba in __CFXNotificationPost
#11 0x94803d93 in _CFXNotificationPostNotification
#12 0x95312440 in -[NSNotificationCenter postNotificationName:object:userInfo:]
#13 0x9531bc88 in -[NSNotificationCenter postNotificationName:object:]
#14 0x9537c10a in -[NSUndoManager(NSUndoManagerPrivate) _postCheckpointNotification]
#15 0x9537bf73 in -[NSUndoManager endUndoGrouping]
#16 0x948aaa8c in -[NSSet makeObjectsPerformSelector:withObject:]
#17 0x9535a750 in +[NSUndoManager(NSUndoManagerPrivate) _endTopLevelGroupings]
#18 0x93db1d27 in -[NSApplication run]
#19 0x93d7ef14 in NSApplicationMain


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?

Ruotger

P.S.: I think all this started around 10.5.3 or 10.5.4 but I'm not sure

_______________________________________________

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


  • Follow-Ups:
    • Re: NSUndoManager f@*#ing up Core Data database
      • From: Keary Suska <email@hidden>
    • Re: NSUndoManager f@*#ing up Core Data database
      • From: Ron Lue-Sang <email@hidden>
  • Prev by Date: Re: Conditional mouseDownCanMoveWindow for NSView?
  • Next by Date: Re: Trouble with NSSplitView
  • Previous by thread: Re: CALayer bounds with ResizeAspect mask?
  • Next by thread: Re: NSUndoManager f@*#ing up Core Data database
  • Index(es):
    • Date
    • Thread