Subject: Re: EXC_BAD_ACCESS and NSAttributedString driving
me crazy



Can you try temporarily disabling garbage collection around the unarchiving of RTFD, and see if it helps?

[[NSGarbageCollector defaultCollector] disable];
... unarchive your RTFD ...
[[NSGarbageCollector defaultCollector] enable];

Ali

On Mar 30, 2009, at 5:25 PM, Chris Idou wrote:

I'm getting NSRTFDPboardType and NSRTFPboardType objects as NSData from the pasteboard and I'm storing them in a core data XML repository and getting them out again, and when necessary I'm converting them into NSAttributedString with initWithRTF or initWithRTFD. This mostly works but every now and then, actually quite often, this initWithRTF(D) crashes with EXC_BAD_ACCESS. (stack traces below).

The thing is, I'm doing an md5Hash on the NSData objects every single time I store them and retrieve them just to make sure they are not corrupted, and the exact same NSData that is working one minute as an argument to initWithRTF(D), makes it crash later on.

I'm using garbage collection, but I've solved a lot of GC problems and this doesn't seem similar.

Has anyone got any thoughts?




#00x95a82688 in objc_msgSend
#10x933b0b26 in -[NSCFDictionary setObject:forKey:]
#20x90824684 in -[NSRTFD setObject:forKey:]
#30x908f3c2f in -[NSAKDeserializer deserializePList:]
#40x908f3961 in -[NSDocumentDeserializer deserializeNewPList]
#50x908f3753 in -[NSRTFD(NSSerializationSupport) initWithPasteboardDataRepresentation:]
#60x908f2fe9 in -[NSFileWrapper initWithSerializedRepresentation:]
#70x908f2e32 in -[NSRTFReader initWithRTFD:]
#80x9070b9a7 in _NSReadAttributedStringFromURLOrData
#90x90709943 in -[NSAttributedString(NSAttributedStringKitAdditions) initWithData:options:documentAttributes:error:]
#100x908f2de2 in - [NSAttributedString(NSAttributedStringKitAdditions) initWithRTFD:documentAttributes:]
......

#00x95a82688 in objc_msgSend
#10x90894910 in processColor
#20x9089395...

b in CharAttr
#30x9088db34 in -[NSRTFReader attributedString]
#40x9070bc03 in _NSReadAttributedStringFromURLOrData
#50x90709943 in -[NSAttributedString(NSAttributedStringKitAdditions) initWithData:options:documentAttributes:error:]
#60x9088c542 in -[NSAttributedString(NSAttributedStringKitAdditions) initWithRTF:documentAttributes:]
.....


Program received signal: “EXC_BAD_ACCESS”.



Enjoy a better web experience. Upgrade to the new Internet Explorer 8 optimised for Yahoo!7. Get it now.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@xxxxxxxxxxxxxxx)

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:
http://lists.apple.com/mailman/options/cocoa-dev/aozer%40apple.com

This email sent to aozer@xxxxxxxxx

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@xxxxxxxxxxxxxxx)

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:
http://lists.apple.com/mailman/options/cocoa-dev/maillists%40codeha.us

This email sent to maillists@xxxxxxxxx



Privacy