• 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
Re: A CFStringRef that throws EXC_BAD_ACCESS
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Re: A CFStringRef that throws EXC_BAD_ACCESS (From: Craig Bakalian <email@hidden>)

  • Prev by Date: Re: A CFStringRef that throws EXC_BAD_ACCESS
  • Next by Date: Re: empty string, or: totally clearing the NSTextStorage
  • Previous by thread: Re: A CFStringRef that throws EXC_BAD_ACCESS
  • Next by thread: Re: A CFStringRef that throws EXC_BAD_ACCESS
  • Index(es):
    • Date
    • Thread