Re: A CFStringRef that throws EXC_BAD_ACCESS
Re: A CFStringRef that throws EXC_BAD_ACCESS
- Subject: Re: A CFStringRef that throws EXC_BAD_ACCESS
- From: Rosyna <email@hidden>
- Date: Thu, 17 Oct 2002 06:44:03 -0700
Ack, at 10/17/02, Craig Bakalian said:
>
I didn't know I could cast a NSString from a CFStringRef. Is
>
there further documentation on stuff like this somewhere? And I
>
agree with you on the code below. But, oddly, it works in certain
>
circumstances.
The NSString and foundation docs talk about it. Just about all
Foundation types are Toll-free bridged with their CoreFoundation
counterparts.
>
>
for if I do this:
>
>
MIDIGetStringProperty(dev, kMIDIPropertyName, &pname)
>
CFStringGetCString(pname, cname, sizeof(cname), 0);
>
CFRelease(pname);
If, for any reason pname ends up being NULL (say, for an error), this
will crash. And it's important to remember, you CANNOT use CFRelease
on a NULL.
>
it works fine, always returning a string value for any midi hardware
>
with no bad access.
>
>
Also, the cmaxtrans not big enough to hold the CFStringRef wasn't
>
what was happening. Once I did your informative (NSString *) cast,
>
the pmaxtrans was null.
When using things like getting a size of a CFString, use something
like CFStringGetMaximumLengthForEncoding (I think that's the name)
--
Sincerely,
Rosyna Keller
Technical Support/Holy Knight/Always needs a hug
Unsanity: Unsane Tools for Insanely Great People
---
Please include any previous correspondence in replies, it helps me
remember what we were talking about. Thanks.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.