Subject: Re: EXC_BAD_ACCESS and NSAttributedString driving
me crazy

Thanks for the links.

If I run with libgmalloc, it dies the same way, but seemingly much quicker:

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000032
0x95a82688 in objc_msgSend ()
(gdb) where
#0 0x95a82688 in objc_msgSend ()
#1 0x90894910 in processColor ()
#2 0x9089395b in CharAttr ()
#3 0x9088db34 in -[NSRTFReader attributedString] ()
#4 0x9070bc03 in _NSReadAttributedStringFromURLOrData ()
#5 0x90709943 in -[NSAttributedString(NSAttributedStringKitAdditions)
initWithData:options:documentAttributes:error:] ()
#6 0x9088c542 in -[NSAttributedString(NSAttributedStringKitAdditions)
initWithRTF:documentAttributes:] ()

I also found a posting with someone with the exact same problem:

I'm not sure what else to try. I'd be inclined to jump to the conclusion of
blaming Apple, if it wasn't that this API must be a very widely called one.

From: Sean McBride <cwatson@xxxxxxx>
To: Chris Idou <idou747@xxxxxxxxx>; cocoa-dev@xxxxxxxxxxxxxxx
Sent: Tuesday, 31 March, 2009 2:43:18 PM
Subject: Re: EXC_BAD_ACCESS and NSAttributedString driving me crazy

Chris Idou (idou747@xxxxxxxxx) on 2009-03-30 8:25 PM said:

>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).<...

br> >
>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?

What else have you tried?



Enjoy a safer 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)

Help/Unsubscribe/Update your Subscription:

This email sent to maillists@xxxxxxxxx