That's a good trick to know! When I bracket the calls thus, it crashes in a 
different but similar place:

#00x95a82688 in objc_msgSend
#10x90894910 in processColor
#20x9089395b in CharAttr
#30x9088db34 in -[NSRTFReader attributedString]
#40x9070bc03 in _NSReadAttributedStringFromURLOrData
#50x90709943 in -[NSAttributedString(NSAttributedStringKitAdditions) 
initWithData:options:documentAttributes:error:]
#60x9088c542 in -[NSAttributedString(NSAttributedStringKitAdditions) 
initWithRTF:documentAttributes:]
#70x908e6f25 in +[_NSRTFPboardTypeConverter pasteboard:provideDataForType:]
#80x908e6b58 in __NSPasteboardProvideData
#90x918dd120 in __CFPasteboardResolvePromiseForItemLocal
#100x918e0680 in CFPasteboardCopyData
#110x9086763e in -[NSPasteboard _dataWithoutConversionForType:]
#120x9086748a in -[NSPasteboard dataForType:]

And then if I bracket the call to dataForType: as well, the crashes stop 
happening. I'm relieved to know I at least have a workaround.

Does this tend to indicate some kind of Apple GC bug?





________________________________
From: Ali Ozer <ao...@apple.com>
To: Chris Idou <idou...@yahoo.com>
Cc: Cocoa Dev <cocoa-dev@lists.apple.com>
Sent: Tuesday, 31 March, 2009 4:12:55 PM
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
> #20x9089395b 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@lists.apple.com)
> 
> 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 ao...@apple.com


      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@lists.apple.com)

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/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to