• 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, NSManagedObject and local data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSUndoManager, NSManagedObject and local data


  • Subject: NSUndoManager, NSManagedObject and local data
  • From: Pechoultres Xavier <email@hidden>
  • Date: Wed, 21 Jun 2006 11:26:44 +0200

Hi,
I need to have a member data in a subclass of NSManagedObject. It's a mutable string, allocating when needed and releasing in didTurnIntoFault message.
But when I delete the object and use the Undo menu, the object reappear well but the local data seems to be released without been set to nil.



@interface MyObject : NSManagedObject { NSMutableString* _cachedInfo; } @end

@implementation MyObject

-(NSString*)info {
if (_cachedInfo == nil) {
_cachedInfo = [[NSMutableString stringWithCapacity:0] retain];
[_cachedInfo appendFormat:@"%@ : %@", [self valueForKey:@"code"], [self valueForKey:@"name"]];
}
return _cachedInfo;
}


- (void) didTurnIntoFault {
	[_cachedInfo release], _cachedInfo = nil;
	[super didTurnIntoFault];
}

@end

After an Undo, the _cachedInfo as the same adress as before but without content !!!

Thanks,


xavier _______________________________________________ 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
  • Prev by Date: How to add menu to menu bar
  • Next by Date: [Q] NSOpenPanel / NSSavePanel customization
  • Previous by thread: Re: How to add menu to menu bar
  • Next by thread: [Q] NSOpenPanel / NSSavePanel customization
  • Index(es):
    • Date
    • Thread