• 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: Craig Bakalian <email@hidden>
  • Date: Thu, 17 Oct 2002 09:04:13 -0400

Thanks for the help Rosyna!

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.

for if I do this:

MIDIGetStringProperty(dev, kMIDIPropertyName, &pname)
CFStringGetCString(pname, cname, sizeof(cname), 0);
CFRelease(pname);

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.

Craig Bakalian

On Thursday, October 17, 2002, at 07:53 AM, Rosyna wrote:

> OSStatus TransErr = MIDIObjectGetStringProperty(dev,
> kMIDIPropertyMaxTransmitChannels, &pmaxtrans);
>
> if(TransErr != kMIDIUnknownProperty ){
>
> CFStringGetCString(pmaxtrans, cmaxtrans, sizeof(cmaxtrans (i
> wrote pmaxtrans before), 0);
>
> CFRelease(pmaxtrans);
>
> [self setMaxTransChannels: [NSString stringWithCString:
> cmaxtrans]];
>
>
> I am guessing this never gets called as it seems like it would crash
> immediately. First, you are using CFRelease to release something that
> you shouldn't (the function you got it from doesn't contain the words
> Copy or Create) which should crash. Second, you get the C string from
> the CFString but release the CFString before using the C string which
> should also probably crash.
_______________________________________________
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.

  • Follow-Ups:
    • Re: A CFStringRef that throws EXC_BAD_ACCESS
      • From: Rosyna <email@hidden>
    • Re: A CFStringRef that throws EXC_BAD_ACCESS
      • From: Chris Ridd <email@hidden>
References: 
 >Re: A CFStringRef that throws EXC_BAD_ACCESS (From: Rosyna <email@hidden>)

  • Prev by Date: Re: NSSplitView query
  • Next by Date: Re: Background threads
  • 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